Laravel API Gateway is a powerful package designed to facilitate the management and routing of API requests in your Laravel application. It provides features such as header manipulation, authentication, and request forwarding.
- Route API requests to different endpoints.
- Manipulate request and response headers.
- Support for multiple authentication methods.
- Easy integration with existing Laravel applications.
You can install the package via Composer:
git clone https://github.com/oixan/laravel_api_gateway.git
In your config/apigateway.php
, you can define the routes for your API Gateway:
return [
'routes' => [
[
'prefix' => '/service1',
'method' => 'GET',
'service_url' => 'https://api.restful-api.dev',
'timeout' => 5000,
'auth' => 'none',
],
// Add more routes as needed
],
];
To start the Laravel development server, run the following command:
php artisan serve
You can now access your API Gateway at http://localhost:8000/api
.
You can test your API Gateway using Postman. Make a request to the appropriate endpoint, e.g., http://localhost:8000/api/service1
, and it will be routed through the gateway.
Contributions are welcome! Please follow these steps to contribute:
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch
). - Make your changes.
- Commit your changes (
git commit -m 'Add some feature'
). - Push to the branch (
git push origin feature-branch
). - Create a new Pull Request.
This package is licensed under the MIT License. See the LICENSE file for details.