aeruz/app-registry-client-bundle
PHP/Laravel bundle that simplifies talking to an App Registry service. Provides a client wrapper for registering apps, fetching metadata, and keeping service discovery details in sync, with configuration suited for framework projects and shared deployments.
Installation
composer require aeruz/app-registry-client-bundle
Add to config/app.php under extra.bundles:
Aeruz\AppRegistryClientBundle\AeruzAppRegistryClientBundle::class
Configuration Publish the default config:
php artisan vendor:publish --provider="Aeruz\AppRegistryClientBundle\AeruzAppRegistryClientBundle" --tag="config"
Update config/packages/aeruz_app_registry_client.yaml with your registry API endpoint and credentials.
First Use Case Fetch application metadata:
use Aeruz\AppRegistryClientBundle\Client\RegistryClientInterface;
class MyService
{
public function __construct(private RegistryClientInterface $registryClient) {}
public function getAppInfo(string $appId): array
{
return $this->registryClient->getApplication($appId);
}
}
Application Discovery
Use RegistryClientInterface to fetch app metadata:
$apps = $this->registryClient->listApplications(['status' => 'active']);
Dependency Resolution Resolve app dependencies recursively:
$dependencies = $this->registryClient->getApplicationDependencies($appId, true);
Event-Driven Updates
Subscribe to registry webhooks (configure in config/packages/aeruz_app_registry_client.yaml):
webhooks:
enabled: true
endpoint: /api/webhooks/registry
events: ['application.updated', 'application.deployed']
Service Container Binding Bind the client to a custom interface for easier testing:
$this->app->bind(
MyAppRegistryClient::class,
fn() => $this->app->make(RegistryClientInterface::class)
);
Caching Layer Cache responses for performance (Laravel Cache):
$this->registryClient->setCacheDriver('redis');
$this->registryClient->setCacheTTL(3600); // 1 hour
Async Operations Use Laravel Queues for long-running operations:
dispatch(new SyncAppRegistry($appId));
Authentication Failures
config/packages/aeruz_app_registry_client.yaml has valid client_id/client_secret.php artisan aeruz:registry:debug
Rate Limiting
$this->registryClient->setRetryPolicy(new RetryPolicy(3, 500));
Webhook Verification
Aeruz\AppRegistryClientBundle\Webhook\Verifier):
$verifier = new Verifier($this->app['config']['aeruz_app_registry.webhooks.secret']);
if (!$verifier->verify($request->getContent(), $request->headers->get('X-Signature'))) {
abort(403);
}
logging:
enabled: true
level: debug
$response = $this->registryClient->getApplication($appId, ['debug' => true]);
Custom Responses Override default response handling:
$this->registryClient->setResponseTransformer(
fn(array $data) => collect($data)->mapWithKeys(...)
);
Middleware Add custom middleware to the HTTP client:
$this->registryClient->getClient()->pushMiddleware(
new AddCustomHeader('X-My-Header', 'value')
);
Event Dispatching Listen for registry events:
event(new ApplicationUpdated($appId, $data));
How can I help you explore Laravel packages today?