Download the PHP package onramplab/laravel-exceptions without Composer
On this page you can find all versions of the php package onramplab/laravel-exceptions. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download onramplab/laravel-exceptions
More information about onramplab/laravel-exceptions
Files in onramplab/laravel-exceptions
Package laravel-exceptions
Short Description Handling Laravel exceptions for logs and API response
License MIT
Informations about the package laravel-exceptions
laravel-exceptions
If you are trying to create a new PHP Composer package, whether it is going to be submitted to packagist.org or just to exist in your Github account, this template package of files will surely help you make the process a lot easier and faster.
Requirements
- PHP >= 8.1;
- composer.
Features
- Follow JSON API Spec
- Add more context to log for errors
- adapter
- Web
- Console
- Job
API Error Response Example
Error Log Example
json { "detail": "A fake message", "adapter": { "type": "API", "route": "test-route", "method": "GET", "url": "http://localhost/test-route", "input": [] }, "errors": [ { "title": "Unable To Do Something", "detail": "A fake message", "exception_class": "OnrampLab\CleanArchitecture\Exceptions\UseCaseException", "stacktrace": [ "## /var/www/html/tests/Unit/Exceptions/HandlerTest.php(149)", "#0 /var/www/html/vendor/phpunit/phpunit/src/Framework/TestCase.php(1548): OnrampLab\CleanArchitecture\Tests\Unit\Exceptions\HandlerTest->handleUseCaseException2()" ] }, { "title": "Fake Domain Exception", "detail": "A fake message", "exception_class": "OnrampLab\CleanArchitecture\Tests\Unit\Exceptions\FakeDomainException", "stacktrace": [ "## /var/www/html/tests/Unit/Exceptions/HandlerTest.php(146)", "#0 /var/www/html/vendor/phpunit/phpunit/src/Framework/TestCase.php(1548): OnrampLab\CleanArchitecture\Tests\Unit\Exceptions\HandlerTest->handleUseCaseException2()" ] } ] }
Tech Features
- PSR-4 autoloading compliant structure;
- PSR-2 compliant code style;
- Unit-Testing with PHPUnit 6;
- Comprehensive guide and tutorial;
- Easy to use with any framework or even a plain php file;
- Useful tools for better code included.
Installation
Useful Tools
Running Tests:
php vendor/bin/phpunit
or
composer test
Code Sniffer Tool:
php vendor/bin/phpcs --standard=PSR2 src/
or
composer psr2check
Code Auto-fixer:
composer psr2autofix
composer insights:fix
rector:fix
Building Docs:
php vendor/bin/phpdoc -d "src" -t "docs"
or
composer docs
Changelog
To keep track, please refer to CHANGELOG.md.
Contributing
- Fork it.
- Create your feature branch (git checkout -b my-new-feature).
- Make your changes.
- Run the tests, adding new ones for your own code if necessary (phpunit).
- Commit your changes (git commit -am 'Added some feature').
- Push to the branch (git push origin my-new-feature).
- Create new pull request.
Also please refer to CONTRIBUTION.md.
License
Please refer to LICENSE.