ngmy / okuribito-laravel
OkuribitoLaravel can monitor view loading and record it. This helps to remove unused view files.
Installs: 6
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
pkg:composer/ngmy/okuribito-laravel
Requires
- php: ^7.1.3
- illuminate/support: 5.5.*|5.6.*|5.7.*|5.8.*
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.0
- mockery/mockery: ^1.0
- orchestra/testbench: 3.5.*|3.6.*|3.7.*|3.8.*
- php-coveralls/php-coveralls: ^2.1
- phpstan/phpstan: ^0.11
- phpunit/phpunit: ^7.0
- squizlabs/php_codesniffer: ^3.0
- symfony/filesystem: ^4.0
This package is auto-updated.
Last update: 2025-09-29 02:57:36 UTC
README
OkuribitoLaravel can monitor view loading and record it. This helps to remove unused view files.
This package is inspired by Ruby's Okuribito gem.
Requirements
OkuribitoLaravel has the following requirements:
- PHP >= 7.1.3
- Laravel >= 5.5
Installation
Execute the require Composer command:
composer require ngmy/okuribito-laravel
This will update your composer.json file and install this package into the vendor directory.
Migration
Execute the migrate Artisan command:
php artisan migrate
This will create the view_load_logs table in your database.
Publishing Configuration
Execute the vendor:publish Artisan command:
php artisan vendor:publish
This will publish the configuration file to the config/ngmy-okuribito-laravel.php file.
You can also use the tag to execute the command:
php artisan vendor:publish --tag=ngmy-okuribito-laravel
You can also use the service provider to execute the command:
php artisan vendor:publish --provider="Ngmy\OkuribitoLaravel\OkuribitoServiceProvider"
Basic Usage
Update the config/ngmy-okuribito-laravel.php file's monitor_views option to the view you want to monitor loading:
'monitor_views' => 'your.view.foo',
You can also specify multiple views:
'monitor_views' => [ 'your.view.bar', 'your.view.baz', ],
You can also use a wildcard:
'monitor_views' => 'your.view.*',
This value is specified in the same format as the first argument of Laravel's View::composer method.
When the specified view is loaded, it is recorded to the view_load_logs table in your database.
You have other options available. See the config/ngmy-okuribito-laravel.php file for details.
Advanced Usage
Customizing Record Method
Creating your implementation of the ViewLoadLogRepositoryInterface interface.
<?php declare(strict_types=1); namespace Your\Namespace; use Ngmy\OkuribitoLaravel\Domain\Model\View\View; use Ngmy\OkuribitoLaravel\Domain\Model\ViewLoadLog\ViewLoadLog; use Ngmy\OkuribitoLaravel\Domain\Model\ViewLoadLog\ViewLoadLogRepositoryInterface; class YourViewLoadLogRepository implements ViewLoadLogRepositoryInterface { public function existsByView(View $view): bool { // Implement your existsByView() method here } public function save(ViewLoadLog $log): void { // Implement your save() method here } }
Binding the ViewLoadLogRepositoryInterface interface to your implementation in your service provider's register method.
$this->app->bind( \Ngmy\OkuribitoLaravel\Domain\Model\ViewLoadLog\ViewLoadLogRepositoryInterface::class, \Your\Namespace\YourViewLoadLogRepository::class );
License
OkuribitoLaravel is open-sourced software licensed under the MIT license.