nuimarkets / laravel-shared-utils
Common Laravel Classes
0.0.26
2025-06-04 03:06 UTC
Requires
- php: ^8.2
- bramus/monolog-colored-line-formatter: ~3.0.0
- laravel/framework: ^8.0|^9.0|^10.0
- monolog/monolog: ^2.0
- sentry/sentry-laravel: ^4.11
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.66.1
- orchestra/testbench: ^7.50
- phpunit/phpunit: ^9.0
Suggests
- php-amqplib/php-amqplib: Required for RabbitMQ health checks (~3.5.0)
README
Shared Classes for Laravel
Note these are specific to our use case however you may find some value in the code.
https://packagist.org/packages/nuimarkets/laravel-shared-utils
Installation
composer require nuimarkets/laravel-shared-utils
Classes
Console
ScheduleRunCommand
- Run scheduled tasks ensuring Log is used for all stdoutTestFailedJob
-TestJob
-WorkCommand
- Run queue work jobs ensuring Log is used for all stdout
Jobs
TestFailedJob
-TestJob
-
Services
SentryEventHandler
- Sentry Event Handler
Testing
DBSetupExtension
- DB Setup Extension for phpUnit to drop/create testing database with migrations run
Exceptions
BaseErrorHandler
- Base Error HandlerBaseHttpRequestException
- Main Exception handler for something gone wrong in the request
Logging
SensitiveDataProcessor
- Log Processor for sanitizing sensitive data in log recordsEnvironmentProcessor
- Log Processor for environment info etcSlackHandler
- Slack HandlerColoredJsonLineFormatter
- Formats log records as colored JSON lines with improved readability.SentryHandler
- Sentry Error Handler with support for tags and exceptionsSourceLocationProcessor
- Log Processor for PHP Source Location
Http
BaseFormRequest
- Base Form Request - logging & error handling bitsClearLadaAndResponseCacheController
- Clear Lada and Response CacheErrorTestController
- Test exception handling by using /test-error?exception=HomeController
- Home Route (hello/health check)HealthCheckController
- Detailed Health ChecksRequestMetrics
- Request Metrics