Download the PHP package lazerg/laravel-enum-pro without Composer

On this page you can find all versions of the php package lazerg/laravel-enum-pro. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-enum-pro

Version Downloads count Repository count Last commit Stars count

Finally, in php81 has been added support for Enums. But as enums are new in php, we do not have some helpers to work with that easily. So with our enum-pro package you have pretty more options for working with enums than built-in methods.

It is just trait Lazerg\LaravelEnumPro\EnumPro which must be added into enum. So it means it use built-in enum class while enhancing it

Installation

Usage

Create a new enum class and use our trait on it.

Calling

With default functions, if you want to get value of case you should write LevelTypes::VERY_EASY->value which is little long. With our package, you can get value of case, by just calling it statically

Names

As you can see, names here VERY_EASY, EASY, MEDIUM, STRONG, VERY_STRONG. To get all case names of enum. you can use these helper methods:

Values

As you can see, values here 1, 2, 3, 4, 5. Common usage is for: validate incoming request data.

Randomize

Sometimes we need to get random value or values from enum. This is mainly used in factories.

Options

While creating admin panel, we always change state of models. And basically, it is recommended to save all state types in enum. So in admin panel we need to get all options of enum for select. That's why we have options() method.

Example of options:

Selections

Sometimes in admin panel, it is easier to give options as array of objects. For such needs we have also selections() method

Example of selections:

Testing

To run test


All versions of laravel-enum-pro with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1|^8.2|^8.3
illuminate/support Version ^6.0|^7.0|^8.0|^9.0|^10.0|^11.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package lazerg/laravel-enum-pro contains the following files

Loading the files please wait ....