PHP code example of marshmallow / gtmetrix

1. Go to this page and download the library: Download marshmallow/gtmetrix library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

marshmallow / gtmetrix example snippets


namespace App;

use Laravel\Nova\Actions\Actionable;
use Marshmallow\GTMetrix\Traits\GTMetrix;

class Post extends Model
{
    use GTMetrix;
    use Actionable;
    // ...

class Post extends Model
{
    // ...

    public function getFullPublicPath()
    {
        return 'https://marshmallow.dev/' . $this->slug;
    }
}

use Marshmallow\GTMetrix\GTMetrixField;

public function fields(Request $request)
{
    return [
        ID::make(__('ID'), 'id')->sortable(),
        GTMetrixField::make('GT Metrix'),
    ];
}

use Marshmallow\GTMetrix\Actions\CheckGTMetrixScore;

public function actions(Request $request)
{
    return [
        new CheckGTMetrixScore,
    ];
}