This guide will walk you through installing and setting up the Litepie Integration package.
- PHP 8.2 or higher
- Laravel 11.0 or higher
- MySQL 8.0+ or PostgreSQL 13+
- Laravel Sanctum or Passport for API authentication
composer require litepie/integration# Publish configuration file
php artisan vendor:publish --provider="Litepie\Integration\IntegrationServiceProvider" --tag="integration-config"
# Publish migrations
php artisan vendor:publish --provider="Litepie\Integration\IntegrationServiceProvider" --tag="integration-migrations"Edit the published configuration file at config/integration.php:
<?php
return [
// Database table name
'table_names' => [
'integrations' => 'integrations',
],
// Authentication guards
'guard' => 'web',
'api_guard' => 'sanctum', // or 'passport'
// Middleware
'middleware' => [
'web' => ['web', 'auth'],
'api' => ['api', 'auth:sanctum'], // or 'auth:passport'
],
// Client ID/Secret lengths
'client' => [
'id_length' => 40,
'secret_length' => 80,
],
// Default status for new integrations
'default_status' => 'active',
// Pagination settings
'pagination' => [
'per_page' => 15,
'max_per_page' => 100,
],
];php artisan migrate# Install Sanctum
composer require laravel/sanctum
# Publish Sanctum config
php artisan vendor:publish --provider="Laravel\Sanctum\SanctumServiceProvider"
# Run Sanctum migrations
php artisan migrateAdd Sanctum middleware to app/Http/Kernel.php:
'api' => [
\Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
'throttle:api',
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],# Install Passport
composer require laravel/passport
# Run Passport migrations
php artisan migrate
# Install Passport
php artisan passport:installIf you want to customize authorization, add to AuthServiceProvider:
use Litepie\Integration\Models\Integration;
use Litepie\Integration\Policies\IntegrationPolicy;
protected $policies = [
Integration::class => IntegrationPolicy::class,
];If you want to listen to integration events, add to EventServiceProvider:
use Litepie\Integration\Events\IntegrationCreated;
use Litepie\Integration\Events\IntegrationUpdated;
use Litepie\Integration\Events\IntegrationDeleted;
protected $listen = [
IntegrationCreated::class => [
// Your listeners here
],
IntegrationUpdated::class => [
// Your listeners here
],
IntegrationDeleted::class => [
// Your listeners here
],
];php artisan route:list | grep integrationYou should see routes like:
GET api/integrationsPOST api/integrationsGET api/integrations/{integration}- etc.
Create a test user and get an access token, then test the API:
# Get all integrations (should return empty array initially)
curl -X GET http://your-app.com/api/integrations \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Accept: application/json"curl -X POST http://your-app.com/api/integrations \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"name": "Test Integration",
"description": "A test integration",
"redirect_uris": ["https://example.com/callback"]
}'cd vendor/litepie/integration
composer install
vendor/bin/phpunit- Migration Errors: Ensure your database connection is properly configured
- Authentication Errors: Make sure Sanctum/Passport is properly installed and configured
- Route Not Found: Check that the service provider is registered
- Permission Denied: Verify that policies are working correctly
Enable Laravel's debug mode to see detailed error messages:
APP_DEBUG=trueCheck Laravel logs for detailed error information:
tail -f storage/logs/laravel.log- Read the Examples documentation
- Customize the configuration as needed
- Set up event listeners for your application
- Implement OAuth flows using the provided traits
- Add rate limiting and security measures
For issues and questions:
- Check the GitHub Issues
- Read the documentation
- Join our community discussions