perfocard / flog
Laravel wrapper for the Flog binary
Requires
- php: >=8.4
- illuminate/support: ^11.0
Requires (Dev)
- orchestra/testbench: ^8.14|^9.0
- phpunit/phpunit: ^11.0.1
README
Flog is a Laravel package that provides an interface to generate fake logs. This package is a wrapper around the flog
binary created by mingrammer/flog.
Installation
Install the package using Composer:
composer require perfocard/flog
Publish the configuration file:
php artisan vendor:publish --provider="Perfocard\Flog\FlogServiceProvider"
Configuration
After publishing, the configuration file config/flog.php
will be available. You can specify the binary path and platform-specific binary paths here:
return [ 'platform' => 'linux-arm64', // Default platform 'binary_path' => 'vendor/perfocard/flog/bin/{platform}/flog', ];
Update the platform
value to match your system's architecture.
Usage
Generate a single log
use Perfocard\Flog\Generator; $log = Generator::generateOne();
Generate multiple logs
use Perfocard\Flog\Generator; $logs = Generator::generate(10);
You can also specify a custom format:
$log = Generator::generateOne('apache_common');
Testing
To test this package, ensure that the tests
directory is registered in the PHPUnit configuration file of your main project.
Add the following to the phpunit.xml
file in your Laravel project:
<testsuites> <testsuite name="Perfocard/Flog Tests"> <directory>vendor/perfocard/flog/tests</directory> </testsuite> </testsuites>
Run the tests:
php artisan test
Contributing
Contributions are welcome! Feel free to submit a pull request or open an issue.
License
This package is open-source software licensed under the MIT license.