Download the PHP package sky337/secure-api without Composer
On this page you can find all versions of the php package sky337/secure-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download sky337/secure-api
More information about sky337/secure-api
Files in sky337/secure-api
Package secure-api
Short Description A secure API package for Laravel with JWT and RBAC.
License MIT
Informations about the package secure-api
SecureAPI Laravel Package
A professional, scalable package for Laravel applications providing JWT Authentication, a robust Role & Permission system (RBAC), and standardized API responses.
Features
- JWT Integration: Seamlessly works with
php-open-source-saver/jwt-auth. - RBAC System: Role and Permission models with custom pivot tables (
role_permission,user_role). - Standardized Responses: Consistent JSON response structure (
status,message,data,errors). - Middleware support: Protect routes using
role:adminsyntax. - Easy Integration: Package-specific trait for User models and controllers.
Installation
1. Require via Composer
If the package is not yet on Packagist, add the following to your main app's composer.json:
Then run:
2. Publish Configuration & Migrations
3. Run Migrations
Configuration
The package configuration is available at config/secure-api.php. You can customize the default roles, permissions, and API response keys here.
Usage
User Model Integration
Add the HasRoles trait to your User model:
Roles & Permissions
Standard API Responses
Use the ApiResponse class or ApiResponseTrait in your controllers:
Standard Response Structure:
Middleware usage
Protect your routes using the role middleware alias:
Example Routes
Contribution Guide
- Fork the repository.
- Create a Feature Branch (
git checkout -b feature/AmazingFeature). - Commit your changes (
git commit -m 'Add some AmazingFeature'). - Push to the branch (
git push origin feature/AmazingFeature). - Open a Pull Request.
License
Distributed under the MIT License. See LICENSE for more information.
All versions of secure-api with dependencies
illuminate/support Version ^10.0|^11.0
php-open-source-saver/jwt-auth Version ^2.1