Package Data | |
---|---|
Maintainer Username: | groovili |
Maintainer Contact: | mbonds1219@gmail.com (Michael Bonds) |
Package Create Date: | 2018-05-08 |
Package Last Update: | 2018-12-31 |
Home Page: | |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2025-02-06 03:11:40 |
Package Statistics | |
---|---|
Total Downloads: | 243 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 3 |
Total Watchers: | 2 |
Total Forks: | 0 |
Total Open Issues: | 0 |
A package built for Lumen that ports most of the make commands from Laravel and adds Form Request Validation functionality.
At the moment package compatible only with Lumen >= 5.6.
Just run the following command
> composer require groovili/lumen-make
or this to enable package only for development needs
> composer require groovili/lumen-make --dev
Uncomment or add this line in bootstrap/app.php
$app->register(App\Providers\EventServiceProvider::class);
And add this to bootstrap/app.php
to enable generators
// To enable generator permanently
$app->register(Groovili\LumenMake\LumenMakeServiceProvider::class);
// To enable generator in development mode
if (env('APP_ENV') !== 'production' || env('APP_ENV') === 'local') {
$app->register(Groovili\LumenMake\LumenMakeServiceProvider::class);
}
Add line to bootstrap/app.php
to enable form requests
$app->register(Groovili\LumenMake\Providers\FormRequestServiceProvider::class);
Then run
> php artisan make:request {name}
Below is example of generated request with validation rules:
<?php
declare(strict_types=1);
namespace App\Http\Requests;
use Groovili\LumenMake\Requests\FormRequest;
/**
* Class FooBarRequest
* @package App\Http\Requests
*/
class FooBarRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules(): array
{
return [
'foo' => 'bail|required|max:255|min:3',
'bar' => 'bail|required|max:255|min:3',
];
}
}
In generated requests Groovili\LumenMake\Requests
is used.
If you want migrate to Laravel - change use line in all generated requests:
use Groovili\LumenMake\Requests\FormRequest;
// change to
use Illuminate\Foundation\Http\FormRequest;
make:job {name}
- Job class in Jobs/
make:console {name}
- Console command in Console/Commands/
make:controller {name}
- Restful controller in Http/Controllers/
make:model {name}
- Model in /
make:middleware {name}
- Middleware class in Http/Middleware/
make:exception {name}
- Exception class in Exceptions/
make:event {name}
- Event class in Events/
make:request {name}
- Request class in Http/Requests/