Can You Build a CLI Image Drawing Laravel App with These Packages?
It’s time for our monthly hunt for new open source libraries to use and contribute to!
If you’re new to Sourcehunt, it’s our monthly post for promoting open source projects that seem interesting or promising and could use help in terms of Github stars or pull requests.
It’s our way of giving back – promoting projects that we use (or could use) so that they gain enough exposure to attract a wider audience, a powerful community and, possibly, new contributors or sponsors.
laracademy/interactive-make [216 ★]
Laravel Interactive Make is a plugin that lets you use Laravel’s make command interactively, without being verbose about exactly what it is you want to generate, as the following gif demonstrates:
The tool will ask you about commands and sub-commands until you reach a point at which you’re happy with what got generated. No more looking up make
commands!
There’s some issues to take care of, so get to helping!
reibengu/laravel-auto-validation [45 ★]
This package will let you remove all manual validation from Laravel Controllers, and instead rely on automatic validation that kicks instantly into action as a given controller and method are called – all you need to do is use the package’s trait in a controller, and set the service provider. Then, you define rules like so:
$rules = [
'UserController' => [
'register' => [
'name' => 'required|max:255',
'email' => ['required', 'email', 'max:255', Rule::unique('users')->where('status', 1)],
'password' => 'required|min:6|confirmed',
'gender' => 'required|in:male,female',
'birthday' => 'required|date_format:Y-n-j',
],
'update' => function ($request) {
return [
'name' => 'required|max:255',
'email' => 'required|email|max:255|unique:users,email,'.$request->user()->id,
'gender' => 'required|in:male,female',
'birthday' => 'required|date_format:Y-n-j',
];
},
],
];
return ['rules' => $rules];
The remainder of the process is automatic, and if validation fails, the request is automatically redirected back to the page from where it came, with error messages about validation flashed into session.
The project has no outstanding issues or pull requests, but why not add some? Here’s an idea: make it dead easy to customize these error messages, and integrate them with Laravel’s translator.
Continue reading %Can You Build a CLI Image Drawing Laravel App with These Packages?%
LEAVE A REPLY
You must be logged in to post a comment.