Download the PHP package cosmicvelocity/lumen-helpers without Composer
On this page you can find all versions of the php package cosmicvelocity/lumen-helpers. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download cosmicvelocity/lumen-helpers
More information about cosmicvelocity/lumen-helpers
Files in cosmicvelocity/lumen-helpers
Package lumen-helpers
Short Description Improves interoperability between Lumen and Laravel.
License Apache-2.0
Informations about the package lumen-helpers
cosmicvelocity/lumen-helpers
Improves interoperability between Lumen and Laravel.
Since Lumen started focusing on providing stateless APIs from 5.2, session etc etc has been removed. However, Lumen, which has a low processing speed, is also attractive for regular web application development.
Fortunately, Lumen can incorporate the components of Laravel and reintroduce the removed function. This library provides functions that are missing when you use Lumen like that.
In addition, it supports the upgrading of applications developed under Lumen 5.1, It can be used for improving implementation compatibility, assuming that you are planning to migrate to Laravel in the future.
Installation
If composer is used, it can be introduced by adding the following description.
When using helpers related to sessions, Lumen needs to be set so that sessions can be used.
To enable sessions with Lumen 5.4, set the Application in bootstrap.php as shown below.
How to use
The helper currently provided is as follows.
I will do the same operation as Laravel 's same name helper.
- abort_if
- abort_unless
- action
- app_path
- asset
- auth
- back
- bcrypt
- cache
- cookie
- csrf_field
- csrf_token
- logger
- method_field
- mix
- old
- policy
- public_path
- report
- session
- validator
In addition, we provide our own helper as below.
-
app_with: An app () compatible helper corresponding to makeWith call. illuminate/container: From 5.4, you can not pass $parameters to make, instead makeWith prepared, By using app_with, make can be done by passing parameters that ask Lumen, illuminate / container version.
-
redirect_with_session: Since the redirect helper from Lumen 5.2 onward does not take over the session, we provide redirect_with_session to inherit the session. However, it must be built in advance such as SessionServiceProvider and session must be enabled in Lumen.
By using redirect_with_session, you will be expecting withErrors, withInput etc. If you want to replace redirect with redirect_with_session you can replace it with bootstrap/app.php as follows.