PHP code example of huy-tran / api-explorer-module

1. Go to this page and download the library: Download huy-tran/api-explorer-module 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/ */

    

huy-tran / api-explorer-module example snippets


return [
    'enabled' => env('API_EXPLORER_ENABLED', true),
    'cache' => env('API_EXPLORER_CACHE', true),
    'cache_ttl' => env('API_EXPLORER_CACHE_TTL', 86400),
    'route_prefix' => env('API_EXPLORER_ROUTE_PREFIX', 'dev/api-explorer'),
    'exclude_patterns' => [
        'boost',
        'up',
        'storage',
    ],
];

class CreateDocumentData extends Data
{
    public function __construct(
        #[Required]
        public Project $project,   // → projectId (number), auto-derived

        #[Required]
        public string $title,
    ) {}
}

use Modules\ApiExplorer\Attributes\BodyField;

class CreateDocumentData extends Data
{
    public function __construct(
        #[BodyField('externalRef', 'text')] // UUID key, text input
        public SomeModel $ref,

        #[BodyField('parentId')]            // custom key name
        public Project $project,
    ) {}
}
bash
php artisan vendor:publish --provider="Modules\\ApiExplorer\\Providers\\ApiExplorerServiceProvider" --tag=config
bash
php artisan vendor:publish --provider="Modules\\ApiExplorer\\Providers\\ApiExplorerServiceProvider" --tag=views
bash
php artisan api-explorer:scan
bash
php artisan api-explorer:clear-cache