Download the PHP package geekk-net/laravel-enum without Composer

On this page you can find all versions of the php package geekk-net/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

Elegant Enum implementation for Laravel

This package is fork of removed one https://github.com/mad-web/laravel-enum.git

This package is not supported. Please switch to php enum.

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

Based on MyCLabs PHP Enum and implements SplEnum interface.

You could find documentation for base features in PHP Enum Readme.

Features:

Simple Enum Example

Installation

For Laravel < 7 version - use 1.0 branch.

You can install the package via composer:

Usage

Make new Enum class via artisan command:

to populate Enum with your own values, pass it after name argument:

Create instance of Enum class

Enums support native Custom Casts feature out of the box. Specify Enum class for attribute in $casts array:

after that you could get and set enum field using enum classes

Enum values labels (Localization)

Create enums.php lang file and declare labels for enum values

and get a label


To override default enum lang file path, publish laravel-enum config

and change lang_file_path option

Validation Rule

You may validate an enum value from a request by using the EnumRule class or Enum::rule() method.

If you want to validate an enum key instead of an enum value you can by specifying you want to validate against the key instead of the value.


To customize validation message, add enum key to validation lang file

Additional methods

getRandomKey(): string

Returns a random key from the enum.

getRandomValue()

Returns a random value from the enum.

label(): string

Returns label for the enum value object

labels(): array

Returns all labels for a enum

is($value): bool

Checks whether the current enum value is equal to a given enum

rule(): EnumRule

Returns instance of validation rule class for the Enum

getConstList(bool $include_default = false): array

Returns all consts (possible values) as an array according to SplEnum::getConstList

Changelog

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.3 || ^8.0
illuminate/console Version ^7.0 || ^8.0
illuminate/support Version ^7.0 || ^8.0
illuminate/translation Version ^7.0 || ^8.0
myclabs/php-enum Version ^1.7.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 geekk-net/laravel-enum contains the following files

Loading the files please wait ....