PHP code example of intragile / laravel-changelog

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

    

intragile / laravel-changelog example snippets


// config/changelog.php
'path' => base_path('CHANGELOG.md'),
'locales' => ['en', 'hu'],

'routes' => [
    'enabled' => false,
    'prefix' => 'changelog',
    'middleware' => ['api'],
    'name' => 'changelog.',
],

// routes/api.php
use IntrAgile\Changelog\Facades\Changelog;

Route::prefix('v1')->middleware('auth:sanctum')->group(function () {
    Changelog::routes();   // GET /api/v1/changelog, /changelog/latest, /changelog/{version}
});

   'routes' => [
       'enabled' => true,
       'prefix' => 'changelog',
       'middleware' => ['api', 'auth:sanctum'],
       'name' => 'changelog.',
   ],
   

Gate::define('view-changelog', fn (?User $user): bool => $user === null || $user->can_see_releases);

use IntrAgile\Changelog\Facades\Changelog;

Changelog::latest('hu');          // ?LocalizedRelease
Changelog::releases('hu');        // list<LocalizedRelease>, honours show_unreleased
Changelog::versions('hu');        // the same as releases()
Changelog::find('1.2.0', 'hu');   // ?LocalizedRelease
Changelog::parsed();              // the base file as written, with parse issues
bash
php artisan vendor:publish --tag=changelog-config
bash
php artisan vendor:publish --tag=changelog-config
bash
php artisan changelog:check
php artisan changelog:check --locale=hu     # only this translation; it must exist