Pros:
Illuminate\Events\Dispatcher) for unified workflows.spatie/laravel-async, laravel-horizon) and justifies adoption for I/O-bound tasks.Cons:
Http client for basic REST calls, Artful’s abstraction may introduce unnecessary complexity. Benchmark against Laravel’s native client for performance-critical paths.ArtfulManager can be bound to Laravel’s container as a singleton or context-bound service, replacing or extending Laravel’s Http facade. Example:
$this->app->singleton(\Artful\Artful::class, function ($app) {
return new \Artful\Artful($app['config']['artful']);
});
config/artful.php, including default HTTP client, plugins, and event listeners. Use Laravel’s config caching (php artisan config:cache) for production.GuzzleHttp\Client with Artful’s client in middleware or service containers. Example:
// app/Providers/ArtfulServiceProvider.php
public function boot() {
$this->app->resolving(\Artful\Artful::class, function ($artful) {
$artful->extend('stripe', function () {
return new \Artful\Client('https://api.stripe.com');
});
});
}
Artful::client('stripe')->post()) or extend Laravel’s Http facade to delegate to Artful.// app/Listeners/LogArtfulEvents.php
public function handle($event) {
if ($event instanceof \Artful\Events\RequestStarted) {
Log::info('API Request', ['url' => $event->getUrl()]);
}
}
league/event to convert Artful’s events to Laravel’s Illuminate\Contracts\Events\Dispatcher.httpFactory → http rename (v1.1.0) and other minor changes may require config updates. Mitigation: Use ^1.1 in composer.json and test with dev-main for pre-release changes.guzzlehttp/psr7:^2.6 but may conflict with Laravel’s guzzlehttp/guzzle:^7. Mitigation: Explicitly require guzzlehttp/psr7 and alias Artful’s client in Laravel’s container.spatie/laravel-swoole). Mitigation: Test in a staging environment with spatie/laravel-swoole and ensure event loop compatibility.Mockery to stub Artful’s client and test plugins in isolation.Http client? If not, evaluate alternatives like spatie/laravel-http-client.yansongda maintain Artful alongside Laravel’s evolving ecosystem? Monitor GitHub activity and consider forking if needed.Illuminate\Http\Client (simpler, built-in).php-http/client (standard-compliant, but lacks Laravel integration).spatie/laravel-http-client (more Laravel-native).laravel-horizon) and test in a staging environment.ArtfulManager as a singleton or context-bound service, replacing or extending Laravel’s Http facade. Example:
$this->app->bind(\Artful\Artful::class, function ($app) {
return new \Artful\Artful($app['config']['artful']);
});
config/artful.php, including:
'clients' => [
'stripe' => [
'base_uri' => 'https://api.stripe.com',
'plugins' => ['auth', 'logging'],
],
],
Illuminate\Events\Dispatcher using a custom listener or league/event.// app/Http/Middleware/ArtfulAuth.php
public function handle($request, Closure $next) {
Artful::client()->withHeaders(['Authorization' => 'Bearer ' . $request->bearerToken()]);
return $next($request);
}
Artful::client('stripe')->post('/payments')) while keeping web routes in Laravel’s router.spatie/laravel-swoole) for async API calls in background jobs or real-time features. Example:
// In a Swoole task worker
Artful::client()->sendAsync('https://api.example.com/webhook');
SendEmailJob) with Artful::client()->send().composer require yansongda/artful:~1.1.ArtfulServiceProvider to bind Artful’s manager.config/artful.php with initial clients/plugins.How can I help you explore Laravel packages today?