A Laravel 11 REST API for managing software licenses for desktop applications.
✅ Complete Laravel 11 Project with Sanctum authentication
✅ License Management System with full CRUD operations
✅ REST API Endpoints for desktop app integration
✅ Bulk License Key Generation with Artisan command
✅ Secure Authentication with Laravel Sanctum
✅ Production-Ready Code with proper validation and error handling
# Navigate to project directory
cd SimpleLicenseManager
# Install dependencies
composer install
# Copy environment file
cp .env.example .env
# Generate application key
php artisan key:generate
# Run migrations
php artisan migrate
# Generate sample license keys
php artisan license:generate 100Update your .env file with your database credentials:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=Simple_license_manager
DB_USERNAME=your_username
DB_PASSWORD=your_passwordphp artisan serveThe API will be available at http://localhost:8000/api
POST /api/register-user- Register admin userPOST /api/login- Login and get tokenGET /api/me- Get user info (requires auth)POST /api/logout- Logout (requires auth)
POST /api/register- Register license with user infoPOST /api/activate- Activate a licenseGET /api/validate/{license_key}- Validate license statusGET /api/licenses- List all licenses (admin, requires auth)
Generate license keys in bulk using the Artisan command:
# Generate 100 license keys
php artisan license:generate 100
# Generate 1000 license keys
php artisan license:generate 1000curl -X POST http://localhost:8000/api/register \
-H "Content-Type: application/json" \
-d '{
"license_key": "Simple-ABCD-EFGH-IJKL-MNOP",
"first_name": "John",
"last_name": "Doe",
"brand_name": "Johns Restaurant",
"phone": "+1234567890",
"os": "Windows 11",
"additional_data": {
"restaurant_id": "REST001",
"location": "New York"
}
}'curl -X POST http://localhost:8000/api/activate \
-H "Content-Type: application/json" \
-d '{"license_key": "Simple-ABCD-EFGH-IJKL-MNOP"}'curl -X GET http://localhost:8000/api/validate/Simple-ABCD-EFGH-IJKL-MNOPid- Primary key (auto increment)license_key- Unique license key (string)first_name- User's first name (string)last_name- User's last name (string)brand_name- Business/brand name (string)phone- Contact phone number (string)os- Operating system (string)additional_data- JSON field for extra data (nullable)status- License status (enum: active, inactive, expired)expires_at- Expiration date (datetime, nullable)created_at- Creation timestampupdated_at- Last update timestamp
SimpleLicenseManager/
├── app/
│ ├── Console/Commands/
│ │ └── GenerateLicenseKeys.php # License key generator
│ ├── Http/Controllers/Api/
│ │ ├── AuthController.php # Authentication endpoints
│ │ └── LicenseController.php # License management endpoints
│ └── Models/
│ ├── License.php # License model
│ └── User.php # User model (with Sanctum)
├── database/migrations/
│ └── 2025_10_02_210917_create_licenses_table.php
├── routes/
│ └── api.php # API routes
├── API_DOCUMENTATION.md # Complete API documentation
├── SimpleLicenseManager.postman_collection.json # Postman collection
├── test_api.php # PHP test script
└── README.md # This file
- Import
SimpleLicenseManager.postman_collection.jsoninto Postman - Update the
base_urlvariable to your API URL - Run the collection to test all endpoints
php test_api.phpSee the complete examples in API_DOCUMENTATION.md
- Token-based Authentication with Laravel Sanctum
- Input Validation on all endpoints
- SQL Injection Protection with Eloquent ORM
- CSRF Protection built into Laravel
- Secure Password Hashing with bcrypt
-
Environment Setup:
- Set
APP_ENV=production - Set
APP_DEBUG=false - Configure proper database credentials
- Set up SSL certificates
- Set
-
Security:
- Use strong passwords for admin accounts
- Regularly rotate API tokens
- Monitor API usage and logs
- Implement rate limiting
-
Performance:
- Use Redis for caching
- Configure database connection pooling
- Set up proper indexing on database tables
- Generated → License key created with
inactivestatus - Registered → User information added to license
- Activated → License status changed to
active - Expired → License status changed to
expired(if expiration date passed)
For technical support or questions about the API, please refer to the complete documentation in API_DOCUMENTATION.md or contact the development team.
This project is proprietary software for Simple licence application license management.