husail / delorean-sdk
DeLorean PHP SDK
Installs: 23
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/husail/delorean-sdk
Requires
- php: ^8.1
- ext-json: *
- cuyz/valinor: ^1.14
- php-http/client-common: ^2.7
- php-http/discovery: ^1.19
- psr/http-client: ^1.0
- psr/http-factory: ^1.0
- psr/http-message: ^1.0|^2.0
- psr/log: ^1.0|^2.0|^3.0
Requires (Dev)
- ext-pcntl: *
- friendsofphp/php-cs-fixer: ^3.60
- laminas/laminas-diactoros: ^3.3
- orchestra/testbench: 9.x-dev
- php-http/curl-client: ^2.3
- php-http/mock-client: ^1.6
- phpstan/phpstan: ^2.1.2
- symfony/var-dumper: ^7.0
This package is auto-updated.
Last update: 2025-11-17 08:07:03 UTC
README
The DELOREAN PHP SDK allows integration with the DeLorean API in any PHP project. It also provides Facades and a Service Provider for enhanced Laravel integration.
📦 Installation
composer require husail/delorean-sdk
🔧 Usage Example
For Non-Laravel PHP Projects:
Basic Usage:
require 'vendor/autoload.php'; use Husail\DeLorean\Client; use Husail\DeLorean\Authentication; $client = new Client( new Authentication(token: 'your-token') ); $response = $client->merchant->all(); if ($response->successful()) { // Handle the response }
With Logging:
require 'vendor/autoload.php'; use Monolog\Logger; use Husail\DeLorean\Client; use Monolog\Handler\StreamHandler; use Husail\DeLorean\Authentication; use Husail\DeLorean\HttpClient\Message\Formatter\SimpleFormatter; $logger = new Logger('my_logger'); $logger->pushHandler(new StreamHandler(__DIR__ . '/delorean.log')); $client = new Client( new Authentication(token: 'your-token'), logger: $logger, formatter: new SimpleFormatter(true) // 'true' enables pretty-printed JSON logs ); $response = $client->merchant->all(); if ($response->successful()) { // Handle the response }
For Laravel:
-
Publish the configuration:
php artisan vendor:publish --provider="Husail\DeLorean\DeLoreanServiceProvider" -
Add environment variables in your
.envfile:DELOREAN_TOKEN=your-token # Optional logging settings: DELOREAN_LOG_ENABLED=false # Enable or disable request/response logging DELOREAN_LOG_FORMATTER_EXPANDED=false # Pretty-print JSON in logs if enabled
-
Use the Facade to interact with the API:
use DeLorean; $response = DeLorean::client()->merchant->all(); if ($response->successful()) { // Handle the response }
-
Configure Logging
When
DELOREAN_LOG_ENABLEDis set totrue, the SDK logs request and response details via Laravel's default logging channel. By default, logs output compact JSON. If you want the JSON output to be more readable (pretty-printed), setDELOREAN_LOG_FORMATTER_EXPANDEDtotrue.
🤝 Contributing
We welcome contributions! Feel free to submit issues or pull requests to help improve the SDK.
📜 License
Licensed under the MIT License.