Download the PHP package cerbero/laravel-enum without Composer

On this page you can find all versions of the php package cerbero/laravel-enum. 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

Laravel Enum

Latest Version on Packagist Build Status Coverage Status Quality Score Total Downloads

Laravel package that introduces a new Artisan command to generate Enum classes.

It provides an easy syntax to specify and map constants in Enum classes while adding PHPDoc tags to make IDEs recognise what constants can be invoked as methods to instantiate an Enum class.

Install

Via Composer

Usage

Enums can be generated by calling the Artisan command make:enum and specifying the class and constant names. Many enums can be defined at once by separating them with pipes (please note the use of quotes):

In the previous example no key has been defined, in this case keys are assumed to be equal to their lowercased constant name. This is how the Status enum will look like:

Nonetheless you may need to define your own keys, that is possible by pairing constant names and keys with an = character:

The command above will generate the following Status enum:

Similarly you can specify enum values by pairing keys and values with an = character:

The above command will generate the following Status enum and implement the map() method:

Sometimes you may want to define array of values in your keys or values, you can do that by providing JSON strings:

This package will take care of building, indenting and formatting the array for you:

You may also generate keys without the need to define them by using the --keys option:

The following paired commands generate the same Enum class:

When --keys is provided, you may define enum values by pairing names and values with an = character:

The command above will generate the following JSON enum:

By default enums are generated in the app/Enums directory. If you prefer a different location, you can set the option --path (or the shortcut -p):

The above command will generate the Status class in app/Other/Directory.

If you try to generate an enum that already exists, the existing enum won't be overwritten unless you set the option --force (or the shortcut -f):

Change log

Please see CHANGELOG for more information on what has changed recently.

Testing

Contributing

Please see CODE_OF_CONDUCT for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-enum with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1|^8.0
illuminate/console Version >=5.6
illuminate/support Version >=5.6
rexlabs/enum Version ^2.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 cerbero/laravel-enum contains the following files

Loading the files please wait ....