PHP code example of eng-mmustafa / canopy

1. Go to this page and download the library: Download eng-mmustafa/canopy 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/ */

    

eng-mmustafa / canopy example snippets


use Dedoc\Scramble\Scramble;
use Dedoc\Scramble\Support\Generator\OpenApi;
use Dedoc\Scramble\Support\Generator\SecurityScheme;

Scramble::afterOpenApiGenerated(function (OpenApi $openApi) {
    $openApi->secure(
        SecurityScheme::http('bearer', 'JWT')
    );
});

use Dedoc\Scramble\Attributes\Group;

#[Group('Admin / Users')]
class UserController
{
    #[Group('Admin / Users / Sessions')]
    public function sessions() {}
}

// config/canopy.php
'rules' => [
    ['group' => 'Admin > Users', 'match' => ['prefix' => 'admin/users/*']],
    ['group' => 'Billing',       'match' => ['middleware' => 'subscribed']],
    ['group' => 'Internal',      'match' => ['namespace' => 'App\\Http\\Controllers\\Internal\\*']],
],

// config/canopy.php
'branding' => [
    'title'  => 'Acme API',
    'logo'   => 'https://acme.test/logo.svg',
    'accent' => '#10b981',   // any CSS color
    'theme'  => 'dark',      // light | dark (initial theme)
],

// config/canopy.php
'memory_limit' => '1024M', // or '-1' for unlimited
bash
php artisan vendor:publish --tag=canopy-config
bash
php -d memory_limit=-1 artisan scramble:export --path=api-docs.json
bash
php artisan vendor:publish --tag=canopy-views
bash
# Generate once with no memory limit
php -d memory_limit=-1 artisan scramble:export --path=api-docs.json