dekalee/cdn77
PHP client for the CDN77 API. Wraps endpoints in Query classes to list, create and delete resources, purge resources or specific files, and fetch resource logs. Suitable for integrating CDN77 management actions into your app (incl. Symfony via bundle).
Query class provides a minimal abstraction over CDN77’s API, fitting Laravel’s service-oriented design. It can be encapsulated as a Laravel service or facade, aligning with the framework’s dependency injection principles.HttpClient with Laravel’s Http facade or Guzzle, injected via the service container.config/ system to externalize CDN77 credentials and endpoints, adhering to the 12-factor app principles.Query class as a singleton or transient service, enabling dependency injection across the application.Cdn77) can simplify usage, masking the underlying complexity and promoting consistency (e.g., Cdn77::purge($path)).HttpClient and bundle structure. Mitigation requires abstracting these dependencies during integration (e.g., via interfaces or adapters).Illuminate\Support\Facades\Http exceptions be mapped to custom events or logging?Log facade or monitoring tools (e.g., Sentry, Laravel Horizon) integrate with this package?env() or encrypted storage (e.g., config:cache) be used?CdnPurged events)?HttpClient with Laravel’s Http facade or Guzzle. Example:
use Illuminate\Support\Facades\Http;
$client = new Cdn77Query(
config('cdn77.api_key'),
Http::baseUrl(config('cdn77.endpoint'))
);
config/cdn77.php to centralize settings:
'cdn77' => [
'api_key' => env('CDN77_API_KEY'),
'endpoint' => 'https://api.cdn77.com',
'timeout' => 30,
'zone_id' => env('CDN77_ZONE_ID'),
]
Query class as a Laravel service:
$this->app->singleton(Cdn77Query::class, function ($app) {
return new Cdn77Query(
$app['config']['cdn77.api_key'],
Http::baseUrl($app['config']['cdn77.endpoint'])
);
});
class Cdn77 extends Facade {
protected static function getFacadeAccessor() { return 'cdn77.query'; }
}
Usage:
Cdn77::purge('path/to/file.jpg');
CdnPurged, CdnResourceCreated) for reactive workflows.Phase 1: Proof of Concept (PoC)
HttpClient → Laravel Http).Phase 2: Laravel Wrapper and Extensions
Cdn77Service class that extends or wraps the original Query class.config/cdn77.php.CdnPurged event).Retry helper or queue workers.Cache::remember).Phase 3: Integration and Testing
Log).Phase 4: Optimization and Scaling
composer.json constraints to enforce version compatibility.composer.json if needed.How can I help you explore Laravel packages today?