Download the PHP package laravel-ops/connector without Composer
On this page you can find all versions of the php package laravel-ops/connector. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download laravel-ops/connector
More information about laravel-ops/connector
Files in laravel-ops/connector
Package connector
Short Description Lightweight connector for Laravel applications to connect to Laravel Ops
License MIT
Informations about the package connector
Laravel Ops Connector
A lightweight, secure connector package for Laravel applications to connect to Laravel Ops central management platform.
Overview
The connector exposes a secure API that allows Laravel Ops to:
- Monitor application health
- Discover capabilities
- Execute allowlisted operations (cache clear, migrations, etc.)
Architecture
Security Features
- HMAC-SHA256 Request Signing - All requests are cryptographically signed
- Timestamp Validation - Requests expire after 5 minutes
- Replay Protection - Nonce-based protection against replay attacks
- Allowlisted Operations - Only explicitly permitted operations can execute
- No Shell Execution - Uses Laravel's Artisan API, never shell_exec
Installation
Install the package through Composer:
The package is available through Packagist once its public source repository has
been submitted there. For development against a local checkout, Composer can
instead use a path repository in your application's composer.json.
Publish Configuration
Configure Credentials
Add to your .env file:
These credentials are provided by Laravel Ops when you register your application.
Register Service Provider
For Laravel 11+, the service provider is auto-discovered. For older versions, add to config/app.php:
Enrollment Flow
Option A: Automatic Enrollment (Recommended)
- In Laravel Ops, generate an enrollment token for your application
- Run the enrollment command:
This will:
- Validate the token with Laravel Ops
- Receive API credentials
- Update your
.envfile automatically
Option B: Manual Configuration
- Register your application in Laravel Ops
- Copy the API credentials from the application detail page
- Add them to your
.envfile:
API Endpoints
Health Check
Returns application health status including:
- Application info (name, URL, Laravel version, PHP version)
- Database connection status
- Cache functionality status
- Connector version
Capability Discovery
Returns supported operations and features:
- Connector version
- Laravel version
- List of allowed operations
- Available features (queue, scheduler, etc.)
Enrollment
Enrolls the connector with Laravel Ops using a short-lived enrollment token.
Request Signing
All requests (except enrollment) must include these headers:
Signature Calculation
Configuration
Allowed Operations
Edit config/connector.php to customize allowed operations:
Security Settings
Testing the Connection
From Laravel Ops, you can test the connection:
- Go to your application detail page
- Click "Test Connection"
- If successful, the status will change to "Connected"
Or via CLI:
Troubleshooting
"Invalid API key" error
- Check that
CONNECTOR_API_KEYin.envmatches the key in Laravel Ops - Ensure there are no extra spaces or line breaks
"Request timestamp is too old" error
- Check that your server's clock is synchronized (NTP)
- Increase
timestamp_toleranceinconfig/connector.phpif needed
"Request nonce has already been used" error
- This indicates a possible replay attack
- Each request must have a unique nonce
- Check your HTTP client isn't retrying requests
"Invalid request signature" error
- Verify
CONNECTOR_API_SECRETis correct - Check signature calculation matches the expected format
- Ensure body hash is included for POST requests
Connection timeout
- Check firewall allows HTTPS connections
- Verify the base URL in Laravel Ops is correct
- Check SSL certificate validity
Security Best Practices
- Keep secrets secure - Never commit
.envto version control - Use HTTPS - Always use HTTPS in production
- Rotate credentials - Regenerate API keys periodically
- Monitor logs - Watch for authentication failures
- Limit operations - Only enable operations you need
- Revoke when needed - Use the revoke feature if a connector is compromised
Requirements
- PHP 8.1 or higher
- Laravel 10.x or 11.x
- HTTPS connection to Laravel Ops
- Valid API credentials
Version History
- 1.0.0 - Initial release
- Health check endpoint
- Capability discovery
- Request signing with HMAC
- Enrollment flow
- Replay protection
License
MIT License
Support
For issues and questions, please refer to the Laravel Ops documentation or open an issue in the main repository.