Showing posts with label php. Show all posts
Showing posts with label php. Show all posts

Friday, June 27, 2025

NVM Activation error

When you install nvm latest verion and want to swith the node to use the latest verion , you get the activation error as below: 

>> nvm install 22.13.1 
Installation complete. If you want to use this version, 
type: nvm use 22.13.1 

>> nvm use 22.13.1

 exit status 1: 'C:\Program' is not recognized as an internal or external command, 
operable program or batch file. 
 activation error: exit status 1: 'C:\Program' is not recognized as an internal or external command, operable program or batch file.


This error is happening because your nvm is installed in a path that includes a space (like C:\Program Files\...), and it's not properly handling that space.

Here's how to fix it:

Solution: Reinstall nvm-windows to a path without spaces
Uninstall the current NVM:
Go to Add or Remove Programs and uninstall nvm.

Reinstall NVM to a space-free path:
Download the latest nvm-setup.zip from https://github.com/coreybutler/nvm-windows/releases.
During installation, change the installation path to something like:
Also set the Node.js install path to something like:

After installation, try again:

Alternative (Quick Test, not recommended long-term)
You can temporarily fix this by manually editing your settings.txt file:
Go to:
Update these paths to use short path notation (like C:\Progra~1) or better: move them to a location without spaces.

    • C:\nvm
    • C:\nodejs
  1. nvm install 22.13.1
    nvm use 22.13.1
  2. C:\Users\<YourUsername>\AppData\Roaming\nvm\settings.txt
Now check this issue, it should work fine,

Wednesday, June 18, 2025

Implementation of seamless authentication between two Laravel apps

 

When a user logs in to one application, they should also be authenticated in other application without logging in again.

1. Use a Common Authentication System

Ensure both Laravel apps share the same user database (either directly or via API).


2. Use tymon/jwt-auth in both apps

Install JWT package in both:

composer require tymon/jwt-auth
php artisan vendor:publish --provider="Tymon\JWTAuth\Providers\LaravelServiceProvider" php artisan jwt:secret

Do this in both apps. Say App A and App B


3. Generate Token in App A on Login

In App A, modify the login logic to generate a JWT token:

use Tymon\JWTAuth\Facades\JWTAuth;
public function login(Request $request) { $credentials = $request->only('email', 'password'); if (!$token = JWTAuth::attempt($credentials)) { return response()->json(['error' => 'Invalid credentials'], 401); } // Send token to front-end return response()->json(['token' => $token]); }

4. Share JWT Token with App B

When user logs in:

  1. Save token in a secure cookie:


return response()->json(['success' => true])->cookie( 'jwt_token', $token, 60, '/', '.seellab.com', true, true, false, 'Strict' );

✅ This cookie is available to all subdomains, like  App A and App B

  1. Alternatively, you can redirect to App B with token in query:

a
https://appbUrl/auth/jwt-login?token=xyz123

5. Accept and Authenticate in App B

In AppB, create a route like:

Route::get('/auth/jwt-login', function (Request $request) { $token = $request->get('token') ?? $request->cookie('jwt_token'); try { $user = JWTAuth::setToken($token)->authenticate(); Auth::login($user); return redirect('/dashboard'); // or wherever } catch (\Exception $e) { return redirect('/login')->withErrors('Token Invalid'); } });

You can auto-trigger this on page load, or have a middleware that checks and redirects accordingly.


6. Keep It Secure

  • Use HTTPS.

  • Mark cookie as Secure, HttpOnly, and SameSite=Strict if possible.

  • Tokens should expire, and refresh tokens can be used optionally.

  • If hosting under different domains (not subdomains), cookies won't be shareable — you'll need to redirect with the token.


Optional: Middleware in App B

Create a middleware to auto-login using the JWT cookie if user not logged in:

public function handle($request, Closure $next)
{ if (!Auth::check() && $request->cookie('jwt_token')) { try { $user = JWTAuth::setToken($request->cookie('jwt_token'))->authenticate(); Auth::login($user); } catch (\Exception $e) { // token expired or invalid } } return $next($request); }

Summary

FeatureImplementation
Token Generation            On login in App A
Token SharingSecure Cookie or URL param
Token ReadingApp B reads token from cookie/URL
Login SessionAuth::login($user) in App B
SecurityHTTPS, HttpOnly, SameSite, Token Expiry

Thursday, February 27, 2025

Implementation of Tabview in Laravel

To create a tabbed view in Laravel Blade for "My Organizations" and "All Organizations," you can use Bootstrap, a popular CSS framework. Below is an example:

Steps:

  1. Add Bootstrap CSS and JS:
    Include the Bootstrap CSS and JS files in your Blade layout file, e.g., app.blade.php.

    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
  2. Create a Blade File with Tabs:
    Create a Blade view file, e.g., organizations.blade.php.

    <!-- resources/views/organizations.blade.php -->
    <div class="container mt-5"> <ul class="nav nav-tabs" id="organizationTabs" role="tablist"> <!-- Tab Links --> <li class="nav-item" role="presentation"> <button class="nav-link active" id="my-organizations-tab" data-bs-toggle="tab" data-bs-target="#my-organizations" type="button" role="tab" aria-controls="my-organizations" aria-selected="true"> My Organizations </button> </li> <li class="nav-item" role="presentation"> <button class="nav-link" id="all-organizations-tab" data-bs-toggle="tab" data-bs-target="#all-organizations" type="button" role="tab" aria-controls="all-organizations" aria-selected="false"> All Organizations </button> </li> </ul> <div class="tab-content" id="organizationTabsContent"> <!-- My Organizations Tab --> <div class="tab-pane fade show active" id="my-organizations" role="tabpanel" aria-labelledby="my-organizations-tab"> <h3 class="mt-3">My Organizations</h3> <ul> @foreach ($myOrganizations as $organization) <li>{{ $organization->name }}</li> @endforeach </ul> </div> <!-- All Organizations Tab --> <div class="tab-pane fade" id="all-organizations" role="tabpanel" aria-labelledby="all-organizations-tab"> <h3 class="mt-3">All Organizations</h3> <ul> @foreach ($allOrganizations as $organization) <li>{{ $organization->name }}</li> @endforeach </ul> </div> </div> </div>
  3. Pass Data to the View:
    In your controller, pass the myOrganizations and allOrganizations collections to the view.

    public function showOrganizations()
    { $myOrganizations = Organization::where('user_id', auth()->id())->get(); $allOrganizations = Organization::all(); return view('organizations', compact('myOrganizations', 'allOrganizations')); }
  4. Route to the View:
    Add a route for the controller method in web.php.

    Route::get('/organizations', [OrganizationController::class, 'showOrganizations'])->name('organizations.index');

Result:

  • A tabbed interface where:
    • The "My Organizations" tab lists only the organizations related to the logged-in user.
    • The "All Organizations" tab lists all organizations in the database.

Friday, January 17, 2025

Estimating the development timeline for an API when SQL queries are ready

Estimating the development timeline for an API when SQL queries are ready involves evaluating several factors. Here's a step-by-step approach:

1. Define API Scope

  • Number of Endpoints: Count how many API endpoints need to be created.
  • Complexity per Endpoint: Consider if endpoints are simple (e.g., a single query) or complex (e.g., require multiple queries or custom logic).
  • Authentication and Authorization: Determine if additional work is needed for securing the API.

2. Assess Development Components

  • Data Layer: Since SQL queries are ready, consider if additional transformations or validations are needed before returning data.
  • Business Logic: Identify if any specific computations or logic need to be applied to the data retrieved by SQL.
  • API Design:
    • Standardize response formats (e.g., JSON, XML).
    • Error handling and status codes.
  • Documentation: Include time for creating API documentation (e.g., Swagger, Postman).

3. Select Tools and Frameworks

  • Framework Choice: The time required may vary depending on the API framework or language (e.g., Flask, Django, Express.js).
  • Existing Boilerplate: If you have a starter template or boilerplate, it can save significant time.

4. Allocate Time per Endpoint

  • Simple endpoints: 1–2 hours (direct query mapping).
  • Medium complexity: 3–5 hours (data transformation or minor business logic).
  • High complexity: 6+ hours (multiple queries, external integrations).

5. Include Testing

  • Unit testing for individual functions.
  • Integration testing for endpoints.
  • Load testing if performance is critical.

6. Deployment and Setup

  • Include time for setting up the server, deploying the API, and configuring CI/CD pipelines.

7. Buffer for Debugging

  • Add a buffer of 10–20% for unforeseen issues, such as debugging or performance optimizations.

Example Timeline

TaskTime Estimate
API design (initial)4–8 hours
Simple endpoints1–2 hours/endpoint
Medium complexity endpoints3–5 hours/endpoint
High complexity endpoints6–10 hours/endpoint
Authentication setup6–10 hours
Testing10–15% of development time
Deployment and setup4–8 hours

Tips for Accuracy

  • Break down tasks as granularly as possible.
  • Review estimates with the team (if applicable).
  • Use past project timelines as references.

Wednesday, January 15, 2025

Allowed memory size of 134217728 bytes exhausted (tried to allocate 20971520 bytes) while accessing a page of the site

 Fatal Error: Allowed Memory Size of 134217728 Bytes Exhausted error in my web application, while accessing a page. To solve this issue, we have to do a configuration change in php.ini of our web server.

Follow these steps to update memory limit to resolve this error from the Mac/Ununtu terminal:

  1. Determine PHP version from terminal

RUN: php -v

  1. Navigate to php.ini file

REFERENCE: nano /etc/php/{PHP_VERSION}/php.ini

RUN: nano /etc/php/8.3/php.ini

  1. Use up and down arrows to locate memory storage and update storage allocation (this was surprisingly far down) memory_limit = 128M

Update to 256M

  1. Save and exit php.ini

Ctrl + O to save changes in nano

Enter to save to file

Ctrl + X to exit

This resolved this error for me! Hope this helps

Tuesday, January 7, 2025

How to get the auto incremented id after adding the data in mysql

 In one of the project we were working on, we had a situation, where we need to add a record to the table of the database. The added record id is auto incremented in database. This id needs to added to another table with some more data. Now the issue here is how to get the auto increamented value of the previous table. 

In PHP, you can retrieve the auto-incremented ID generated by a INSERT operation in a MySQL database using the mysqli_insert_id() function. Here's how you can do it:

Example Code

<?php // Database connection $servername = "localhost"; $username = "root"; $password = ""; $database = "your_database"; $conn = new mysqli($servername, $username, $password, $database); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } // Insert query $sql = "INSERT INTO your_table (column1, column2) VALUES ('value1', 'value2')"; if ($conn->query($sql) === TRUE) { // Get the last inserted ID $last_id = $conn->insert_id; echo "New record created successfully. Last inserted ID is: " . $last_id; } else { echo "Error: " . $sql . "<br>" . $conn->error; } // Close connection $conn->close(); ?>

Explanation

  1. Database Connection: Establishes a connection to the MySQL database using mysqli.
  2. Insert Query: Executes an INSERT statement.
  3. Retrieve Last ID:
    • $conn->insert_id retrieves the auto-incremented ID of the last inserted record.
  4. Error Handling: Checks if the query was successful before attempting to retrieve the ID.
  5. Close Connection: Always close the database connection after performing operations.

Notes

  • Make sure the column is defined as AUTO_INCREMENT in the table schema.
  • If you're using a database abstraction library like PDO, you can use PDO::lastInsertId() instead.
  • Ensure proper escaping or use prepared statements to prevent SQL injection. For example:

$stmt = $conn->prepare("INSERT INTO your_table (column1, column2) VALUES (?, ?)"); $stmt->bind_param("ss", $value1, $value2); $stmt->execute(); $last_id = $stmt->insert_id; $stmt->close();

This approach is more secure and should be preferred for user input.

In Laravel, retrieving the auto-incremented ID after inserting a record is straightforward, especially if you are using Eloquent or the query builder.
Using Eloquent
If you are using Eloquent, the save method or the create method automatically returns the auto-incremented ID of the record.

// Example 1: Using save()
$model = new YourModel();
$model->column1 = 'value1';
$model->column2 = 'value2';
$model->save();
$lastInsertedId = $model->id; // Retrieves the auto-incremented ID
// Example 2: Using create()
$model = YourModel::create([
'column1' => 'value1',
'column2' => 'value2',
]);
$lastInsertedId = $model->id; // Retrieves the auto-incremented ID

Using Query Builder

If you are using Laravel's query builder, you can use the insertGetId method, which inserts a record and directly returns the auto-incremented ID.

$lastInsertedId = DB::table('your_table')->insertGetId([
'column1' => 'value1',
'column2' => 'value2',
]);
echo "The last inserted ID is: " . $lastInsertedId;

Explanation
Eloquent Approach:
  • $model->save(): Saves the record to the database and updates the $model->id property with the auto-incremented ID.
  • YourModel::create(): Inserts the record and returns the model instance with the id property set.
  • Ensure that the $fillable property in your model is defined for mass assignment in create().
Query Builder Approach:
  • insertGetId: Inserts the record and directly returns the ID of the inserted record.
Notes
  • Eloquent automatically manages timestamps (created_at, updated_at) if the table has them, so you don't need to handle them manually.
  • If using create(), make sure the YourModel class has the $fillable or $guarded property defined:
  • For additional security, always validate and sanitize input data before inserting it into the database. Use Laravel's validation mechanisms.
protected $fillable = ['column1', 'column2'];

Monday, January 6, 2025

How to check and change innodb buffer pool size in mysql database

 The InnoDB buffer pool size in MySQL determines how much memory is allocated to store frequently accessed data and indexes. To check and change it, follow these steps:

1. Check Current InnoDB Buffer Pool Size

    Log in to MySQL
        mysql -u root -p
   Run the Following Query
        SHOW VARIABLES LIKE 'innodb_buffer_pool_size';

This will display the current size in bytes.


2. Change InnoDB Buffer Pool Size

    a. Edit the MySQL Configuration File

The InnoDB buffer pool size is set in the MySQL configuration file (my.cnf or my.ini).

  1. Open the configuration file in a text editor (e.g., nano on Ubuntu):

    sudo nano /etc/mysql/my.cnf
  2. Locate the [mysqld] section and add or update the following line:

    innodb_buffer_pool_size = 1G

    Replace 1G with the desired size (e.g., 512M, 2G, etc.).

    • Best Practice: Set the buffer pool size to around 70-80% of your server's total RAM if MySQL is the primary application on the server.
    b. Save and Exit

    Save the changes and exit the text editor.

    c. Restart MySQL Service

        Restart MySQL to apply the changes:

        sudo systemctl restart mysql

3. Verify the Change

Log in to MySQL again and run the query to confirm the new buffer pool size:

        SHOW VARIABLES LIKE 'innodb_buffer_pool_size';

Additional Notes
  • For servers with large memory, consider splitting the buffer pool into multiple instances:

    innodb_buffer_pool_instances = 4

    This setting improves performance for systems with a high buffer pool size.

  • If MySQL fails to restart, check the error log for details:

    sudo tail -n 50 /var/log/mysql/error.log

Saturday, January 4, 2025

Setting of Auto backup of Mysql database in a laravel project

 When we work on any database project, it's always good to set up autoback of the database on daily basis. We can set up a cron job for backing up a MySQL database in a Laravel project, follow these steps:

1. Create a Laravel Artisan Command

  1. Run the following command to create a custom Artisan command:

    php artisan make:command BackupDatabase
  2. Open the generated file in app/Console/Commands/BackupDatabase.php and update its content:

    <?php
    namespace App\Console\Commands; use Illuminate\Console\Command; use Illuminate\Support\Facades\Storage; class BackupDatabase extends Command { /** * The name and signature of the console command. * * @var string */ protected $signature = 'backup:database'; /** * The console command description. * * @var string */ protected $description = 'Backup the MySQL database'; /** * Execute the console command. */ public function handle() { $dbName = env('DB_DATABASE'); $dbUser = env('DB_USERNAME'); $dbPassword = env('DB_PASSWORD'); $dbHost = env('DB_HOST', '127.0.0.1'); $backupPath = storage_path('app/backups/' . date('Y-m-d_H-i-s') . '_backup.sql'); // Ensure the backup directory exists Storage::makeDirectory('backups'); $command = sprintf( 'mysqldump -u%s -p%s -h%s %s > %s', escapeshellarg($dbUser), escapeshellarg($dbPassword), escapeshellarg($dbHost), escapeshellarg($dbName), escapeshellarg($backupPath) ); $result = null; $output = null; exec($command, $output, $result); if ($result === 0) { $this->info('Database backup created successfully: ' . $backupPath); } else { $this->error('Failed to create database backup.'); } } }

2. Schedule the Command in Laravel

  1. Open the app/Console/Kernel.php file.

  2. Register the new command in the schedule method:

    protected function schedule(Schedule $schedule)
    { $schedule->command('backup:database')->dailyAt('02:00'); }

    This schedules the backup to run daily at 2:00 AM. Adjust the time as needed.


3. Set Up the Cron Job

  1. Open the cron jobs configuration file:

    crontab -e
  2. Add the following line to execute Laravel's scheduler every minute:

    * * * * * php /path-to-your-laravel-project/artisan schedule:run >> /dev/null 2>&1

    Replace /path-to-your-laravel-project with the actual path to your Laravel application.


4. Verify Backup Files

  1. The backups will be stored in the storage/app/backups directory.
  2. Ensure the directory is writable by the web server and the Laravel application.

5. Additional Suggestions

  • Compression: Modify the command to compress the backup:

    $command = sprintf(
    'mysqldump -u%s -p%s -h%s %s | gzip > %s.gz', escapeshellarg($dbUser), escapeshellarg($dbPassword), escapeshellarg($dbHost), escapeshellarg($dbName), escapeshellarg($backupPath) );
  • Cloud Storage: Use Laravel's filesystem to store the backups on S3, Google Cloud Storage, etc.

Saturday, June 22, 2024

How to migrate a perticular file in laravel php artisan

 In Laravel, if you need to run the migration for a particular file, you can achieve this by using the --path option with the php artisan migrate command. This allows you to specify the path of the migration file you want to execute.

Here's how you can do it:

  1. Locate the Migration File: Find the path to the migration file you want to run. The default location for migration files is the database/migrations directory.

  2. Run the Migration for the Specific File: Use the php artisan migrate command with the --path option to specify the path to the migration file. The path should be relative to the base directory of your Laravel project.

Here is an example command:

php artisan migrate --path=/database/migrations/2021_06_01_000000_create_users_table.php

In this example, replace /database/migrations/2021_06_01_000000_create_users_table.php with the actual path and filename of your migration file.

Step-by-Step Example

  1. Navigate to Your Project Directory: Open your terminal and navigate to the root directory of your Laravel project.

  2. Run the Migration: Execute the following command, replacing the path with the path to your specific migration file.

    php artisan migrate --path=/database/migrations/your_migration_file.php

Important Considerations

  • Ensure the specified migration file exists at the given path.
  • If the migration has already been run before, it will not run again unless it is rolled back first. You can roll back a specific migration using the --path option with the migrate:rollback command.

Rolling Back a Specific Migration

To roll back a specific migration, you can use the --path option with the migrate:rollback command:

php artisan migrate:rollback --path=/database/migrations/your_migration_file.php

Summary

Using the --path option with php artisan migrate allows you to run a specific migration file in Laravel. This can be useful for debugging or when you only need to run a particular migration without affecting others.

Friday, May 31, 2024

Tips for Improving Website Speed

Speed of the website is very much important while developing a website. In my last blog I explained how to find the speed of your website. Now in this blog we will discuss how to improve the speed of the website. Below are some tips to improve the speed of the website 

Optimize Images: Compress images without losing quality.

Enable Caching: Use browser and server caching to reduce load times.

Minify CSS and JavaScript: Remove unnecessary characters from code to reduce file sizes.

Use a Content Delivery Network (CDN): Distribute content across multiple servers to speed up delivery.

Reduce HTTP Requests: Limit the number of requests your site makes to load a page.

Optimize Server Response Time: Ensure your server responds quickly to requests.

Using these tools and implementing their recommendations can significantly improve your website’s performance.

Improving the speed of your website involves several strategies, from optimizing your code to leveraging various performance-enhancing technologies. Here’s a comprehensive guide to help you increase your website’s speed:

1. Optimize Images

  • Compress Images: Use tools like TinyPNG, ImageOptim, or online services like Kraken.io to reduce image file sizes without compromising quality.
  • Use Correct Formats: Use JPEG for photographs, PNG for images with transparency, and SVG for icons and vector graphics.
  • Lazy Loading: Implement lazy loading to delay the loading of images until they are about to enter the viewport.

2. Enable Caching

  • Browser Caching: Configure your web server to set caching headers for static resources, so browsers can cache them locally.
  • Server-Side Caching: Use caching mechanisms like Memcached or Redis to store frequently accessed data in memory.

3. Minify CSS, JavaScript, and HTML

  • Minify Files: Remove unnecessary characters, whitespace, and comments from your code. Tools like UglifyJS, CSSNano, and HTMLMinifier can help with this.
  • Concatenate Files: Combine multiple CSS and JavaScript files into single files to reduce the number of HTTP requests.

4. Use a Content Delivery Network (CDN)

  • CDN Services: Services like Cloudflare, Akamai, and Amazon CloudFront distribute your content across multiple servers globally, reducing the distance data needs to travel to reach the user.

5. Optimize Server Response Time

  • Choose a Fast Web Host: Select a reliable hosting provider known for high performance.
  • Upgrade Server Resources: Increase server resources such as CPU and RAM if you’re on a VPS or dedicated server.
  • Use Fast Software: Implement server-side technologies like NGINX or LiteSpeed instead of Apache for faster response times.

6. Reduce HTTP Requests

  • Limit External Resources: Reduce the number of external scripts, fonts, and stylesheets.
  • Inline Small CSS and JavaScript: For very small CSS and JavaScript files, inline them directly into the HTML to reduce the number of requests.

7. Enable Gzip Compression

  • Compress Files: Enable Gzip compression on your server to reduce the size of HTML, CSS, and JavaScript files sent to the browser.

8. Leverage Browser Caching

  • Set Expiry Dates: Use HTTP headers to set expiry dates or max-age for static resources, so browsers cache them and don’t reload on every visit.

9. Optimize Database Queries

  • Database Indexing: Ensure that your database is properly indexed to speed up queries.
  • Use Efficient Queries: Optimize your SQL queries to reduce load times, and avoid retrieving unnecessary data.

10. Reduce Plugins and Third-Party Scripts

  • Limit Plugins: Deactivate and delete any unnecessary plugins, especially those that load a lot of scripts and styles.
  • Asynchronous Loading: Load third-party scripts asynchronously to prevent them from blocking the rendering of the page.

11. Implement AMP (Accelerated Mobile Pages)

  • Use AMP: For content-heavy pages, implement AMP to create fast-loading versions of your pages for mobile users.

12. Use Modern Web Technologies

  • HTTP/2: Upgrade to HTTP/2 for improved performance, as it allows multiplexing multiple requests over a single connection.
  • Prefetching and Preloading: Use link prefetching and preloading to load resources in advance.

13. Monitor Performance Regularly

  • Regular Testing: Use tools like Google PageSpeed Insights, GTmetrix, Pingdom, and WebPageTest to regularly check your website’s performance.
  • Continuous Optimization: Keep your site optimized by regularly reviewing and updating your performance strategies based on test results.

Conclusion

Implementing these strategies can significantly improve your website's loading speed, resulting in a better user experience and potentially higher search engine rankings. Regular monitoring and continuous optimization are key to maintaining high performance as your site evolves.

How to check the speed of your website

Checking the speed of your website is essential for ensuring a good user experience and optimizing your site for search engines. Here are several tools and methods to help you check and analyze your website’s speed:

1. Google PageSpeed Insights:

Google PageSpeed Insights is a free tool that analyzes the content of a web page and provides suggestions to make that page faster. It provides both mobile and desktop results.

How to Use:

  1. Go to [Google PageSpeed Insights] (https://developers.google.com/speed/pagespeed/insights/).
  2. Enter your website URL and click "Analyze".
  3. Review the performance score and suggestions for improvement.

2. GTmetrix:

GTmetrix provides detailed reports on your website's performance, including page load time, total page size, and the number of requests.

 

How to Use:

  1. Go to [GTmetrix](https://gtmetrix.com/).

  2. Enter your website URL and click "Test your site".

  3. Review the detailed performance report, including PageSpeed and YSlow scores.

 

3. Pingdom Website Speed Test:

Pingdom's tool allows you to test the speed of your website from different locations around the world and provides a performance grade and suggestions for improvement.

 

How to Use:

  1. Go to [Pingdom Website Speed Test](https://tools.pingdom.com/).

  2. Enter your website URL, select a test location, and click "Start Test".

  3. Analyze the performance summary and recommendations

4. WebPageTest:

WebPageTest offers advanced testing options, including multi-step transactions, video capture, content blocking, and more. It provides a detailed performance review.

 

How to Use:

  1. Go to [WebPageTest](https://www.webpagetest.org/).

  2. Enter your website URL and select test settings (e.g., location, browser).

  3. Click "Start Test" and review the comprehensive performance analysis.


5. Lighthouse: 

Lighthouse is an open-source, automated tool for improving the quality of web pages. It has audits for performance, accessibility, progressive web apps, SEO, and more.

 

How to Use:

  1. Open Chrome browser.

  2. Go to your website and open DevTools (Ctrl+Shift+I or Cmd+Option+I).

  3. Go to the "Lighthouse" tab.

  4. Click "Generate report".

 

6. Chrome DevTools: 

Chrome DevTools provides in-depth performance analysis directly within the Chrome browser.

 How to Use:

  1. Open Chrome browser.

  2. Visit your website.

  3. Open DevTools (Ctrl+Shift+I or Cmd+Option+I).

  4. Go to the "Network" tab and reload the page to see the loading times and network requests.

  5. Go to the "Performance" tab and record a page load to get a detailed breakdown of the performance metrics.

 

7. Cloudflare: 

If you use Cloudflare, it provides its own analytics and performance metrics that can help you understand and improve your site speed.

 How to Use:

  1. Log in to your Cloudflare account.

  2. Select your site.

  3. Navigate to the "Speed" tab to see performance metrics and suggestions.