Download the PHP package orbas/util without Composer
On this page you can find all versions of the php package orbas/util. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package util
Laravel Util
Laravel Util provides some useful method, such like enum
and presenter
Installation
To get the latest version, simply require the project using Composer:
$ composer require orbas/util
and register the Orbas\Util\ServiceProvider::class
service provider in your config/app.php
Enum
A enum is a distinct type that consists of a set of named constants called the enumerator list.
You can use it in a easier way to make your own enum.
Create a enum class
$ php artisan util:make:enum Gender
That will create a class to app/Enums/
folder
Define the enum
or you can define the key
Enjoy using it
Generate a collection of gender
Get value from key
Use Facade
Add class aliases to the aliases array of config/app.php
:
then you can use it like this
More functionality will be released in the future.
Presenter
or you can call it view presenter. Sometimes you have some logic need to be performed before you put the data.
for example
A presenter is a pattern that you can put the logic far from view and model. (keep model clean, and do what it should do.)
Create a presenter class
$ php artisan util:make:presenter User
That will create a class to app/Presenters
folder
Edit your presenter logic
Put present trait to your model
Usage
Multi-language with Enum
Presenter provides auto translation.
Put enums.php
to resources/lang/YOUR_LOCALE/enums.php
Presenter will translate for you
License
Laravel Util is licensed under The MIT License (MIT).