Download the PHP package isap-ou/laravel-enum-helpers without Composer

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

Laravel Enum Helpers

This package brings some helpers to native PHP Enums

Installation

You can install the package via composer:

You will most likely need to edit the extensive configuration, so you can publish the config file with:

Default config

  1. enum_locations - path where enums located. Key is directory with enums, value - namespace for specified directory
  2. post_migrate - enable or disable post migrate event listener
  3. js_objects_file - path for generated js output
  4. label.prefix - get default prefix for translations of enum fields
  5. label.namespace - get default prefix for translations of enum namespace (when using as part of own package)

Available helpers

Migration helper

The way easy to add all enums to database column.

Just add to Enum trait InteractWithCollection

And in migration class

Update enum columns in DB

Artisan command allows update available(possible) values for specific enum column.

Modify enum:

And run command

There is also a listener enabled by default that will run after a successful migration. To disable it edit enum-helpers.php:

Convert PHP Enums to JS objects

Artisan command allows generate js objects based on enums

Modify enum:

And run command

Output will

You can specify output path in config enum-helpers.php

Label helper

Label helper allows to transform an enum instance into a textual label. This is useful for displaying human-readable translatable enum values in your UI.

and get textual label

By default it will try to find translation with key e.g. ExampleEnum.ENUM_ONE

  1. ExampleEnum - class name
  2. ENUM_ONE - enum item name

Method getLabel has two optional parameters:

  1. prefix - Allows prepend prefix for translation key
  2. namespace - Allows to prepend namespace. Suitable during own package development

There is possibility to define prefix and namespace globally via enum-helpers.config or on enum level via methods

Optional. Can be added interface \IsapOu\EnumHelpers\Contracts\HasLabel that can solve ide autocomplete and tips

This helper compatible with Enums in FilamentPHP

Contributing

Please, submit bugs or feature requests via the Github issues.

Pull requests are welcomed!

Thanks!

License

The AgileCRM Client for Laravel is open-sourced software licensed under the MIT license


All versions of laravel-enum-helpers with dependencies

PHP Build Version
Package Version
Requires illuminate/contracts Version ^9|^10|^11
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 isap-ou/laravel-enum-helpers contains the following files

Loading the files please wait ....