Download the PHP package morcen/passage without Composer
On this page you can find all versions of the php package morcen/passage. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download morcen/passage
More information about morcen/passage
Files in morcen/passage
Package passage
Short Description API gateway for Laravel
License MIT
Homepage https://github.com/morcen/passage
Informations about the package passage
Passage: Lightweight API proxy gateway for Laravel
Introduction
This is a powerful API Gateway package for Laravel that allows you to efficiently manage and route incoming API requests to various microservices. It simplifies the process of handling API requests and responses, enabling seamless communication between clients and microservices.
Features
- Request routing to multiple microservices
- Request payload validation and transformation
- Response payload transformation
- Authentication and authorization handling (coming soon)
- Rate limiting and throttling (coming soon)
- Caching and response caching (coming soon)
- Error handling and logging (coming soon)
Requirements
- PHP version 8.1 or higher
- Laravel version 8.x or higher
Installation
You can install the package via composer:
Then install the package using the following command:
This will publish the package's config file at config/passage.php
.
If you wish to create a controller for handling requests, publish the controller stub using the following command:
and then generate Passage controllers by running:
where {name}
is the name of the controller you want to generate.
Usage
Enabling Passage
To start using this package, add this line in your routes/web.php
to enable Passage:
And make sure that in your .env
, either PASSAGE_ENABLED
is not set or it is set as true
:
Setting gateway routes
Passage as a Proxy
In config/passage.php
, define the services you want to be forwarded.
Example:
Note
- Make sure that the
base_uri
ends with a trailing slash/
, otherwise the request might not be forwarded properly.- All headers, query parameters, as well as the type of request (
GET
,POST
, etc.) will be forwarded to the service.
Transforming/validating requests and response through a Passage controller
If you have a service called github
and you want to handle the incoming and outgoing payloads, you can create a controller for it by running:
This will create a controller at app/Http/Controllers/Passage/GithubPassageController.php
.
In your controller, you can define the following methods:
In your config/passage.php
, add the controller to the services
array:
Using the Passage
facade
If you wish not to use automatic routing of Passage and instead use the Passage services manuall in your controllers, you can use the Passage
facade.
and in your controller:
Disabling Passage
To disable Passage
on a server/application level, set PASSAGE_ENABLED
to false
in your .env
file:
Alternatively, comment this line in your routes/web.php
:
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- Morcen Chavez
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of passage with dependencies
spatie/laravel-package-tools Version ^1.14.0
illuminate/contracts Version ^10.0