Installation:
composer require mohkoma/change-log
php artisan vendor:publish --provider="Mohkoma\ChangeLog\ChangeLogServiceProvider"
First Use Case:
/dev/changelog/create to add your first changelog entry via the provided form./dev/changelog (list view) or /dev/changelog/json (raw JSON).Config Quickstart:
Update config/changelog.php to define your project’s release versions and storage disk:
'versions' => [
'1.0.0' => '2020-10-01',
'2.0.0' => '2024-01-01', // Add future releases
],
'storage_disk' => 'local', // Use 'local' for filesystem storage
Versioned Changelog Management:
/dev/changelog/create to log changes per release (e.g., bug fixes, features).config/changelog.php to auto-group them in the list view.Storage Integration:
storage_disk config to store JSON files in a custom disk (e.g., local, s3). Example:
'storage_disk' => 's3',
'directory_name' => 'public/changelogs',
resources/views/vendor/changelog/list.blade.php).API Access:
$logs = json_decode(file_get_contents(url('/dev/changelog/json')), true);
Middleware Customization:
middleware config:
'middleware' => [
'read' => ['web', 'auth:support'], // Example: Limit to 'support' role
'create' => ['web', 'auth:admin'], // Separate middleware for creation
],
Artisan::call('changelog:create') in a Deploying listener.git log --oneline).fetch('/dev/changelog/json')
.then(res => res.json())
.then(data => renderChangelog(data));
Storage Disk Misconfiguration:
storage_disk isn’t configured, files may save to an unexpected location (default: storage/app/changelog).config/filesystems.php or use 'local'.Version Ordering:
config/changelog.php order (oldest first). Add new versions at the end to maintain chronological order.1.0.0, 2.0.0) for clarity.Form Validation:
web (which includes @method and @csrf).@csrf to the published form view.JSON Merge Issues:
id field.id: Date.now() or id: uuid() in your form data.php artisan route:list to confirm /dev/changelog* routes exist.chmod -R 755 storage/app/changelog
php artisan view:clear
Custom Fields:
resources/views/vendor/changelog/create.blade.php) or override the Changelog model (if available).API Enhancements:
JsonController (located in vendor/mohkoma/change-log/src/Http/Controllers/JsonController.php). Override it in your app:
// app/Http/Controllers/ChangelogJsonController.php
class ChangelogJsonController extends \Mohkoma\ChangeLog\Http\Controllers\JsonController {
public function index() {
// Add custom logic (e.g., filter by version)
return parent::index();
}
}
routes/web.php:
Route::get('/dev/changelog/json', [\App\Http\Controllers\ChangelogJsonController::class, 'index']);
Localization:
resources/lang/en/changelog.php).How can I help you explore Laravel packages today?