PHP code example of ezappslab / laravel-evolver

1. Go to this page and download the library: Download ezappslab/laravel-evolver 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/ */

    

ezappslab / laravel-evolver example snippets




declare(strict_types=1);

use Infinity\Evolver\Contracts\Action;

return new class extends Action
{
    public function introducedIn(): ?string
    {
        return '1.2.0';
    }

    public function 

'api' => [
    'enabled' => true,
    'base_path' => 'api',
    'versions' => [
        'v1' => [
            'routes' => base_path('routes/api/v1.php'),
            'middleware' => ['api'],
            'deprecated_at' => '2027-01-01T00:00:00Z',
            'sunset_at' => '2027-08-01T00:00:00Z',
            'successor' => 'v2',
            'successor_url' => '/api/v2',
        ],
        'v2' => [
            'routes' => base_path('routes/api/v2.php'),
            'middleware' => ['api'],
        ],
    ],
],

->withRouting(
    web: __DIR__.'/../routes/web.php',
    commands: __DIR__.'/../routes/console.php',
    health: '/up',
)

use Infinity\Evolver\Api\ApiVersionContext;

public function __invoke(ApiVersionContext $context): array
{
    return ['api_version' => $context->version()->value];
}
bash
composer evolver:install
php artisan migrate
bash
php artisan evolver:action BackfillUserProfiles
bash
php artisan evolver:status
php artisan evolver:deploy --dry-run
bash
php artisan evolver:api-status
bash
php artisan evolver:deploy