Download the PHP package yokai/enum-bundle without Composer

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

YokaiEnumBundle

Tests Coverage Contributors License

Latest Stable Version Latest Unstable Version Total Downloads Downloads Monthly

This repository aims to provide simple enumeration implementation to Symfony.

Installation

Add the bundle as a dependency with Composer

Enable the bundle in the kernel

Getting started

Let's take an example : our application has some members and each member has a status which can be :

Creating the enum

We first need to create the class that will handle our enum :

That's it, the bundle now knows your enum.

note : every enum has a name. That name is the enum identifier across your application. You can use any string for that purpose, as long it is unique. Using the enum class here is a very common way to do.

Configuring validation

We will now be able to configure Member's model validation :

Setting up the form

Now that validation is configured, the only thing we have to do is to add a field on our form :

Rendering enum label

Display label of any enum value within a Twig template :

Translating your enum

Now, maybe you will need to display the enum label in different locales.

We got you covered here with a dedicated base class for your translated enums :

Now you can create the translation keys in your catalog :

note : the translation key format is generated using the $transPattern constructor argument, which must be valid a sprintf pattern (containing one %s)

More examples

See examples from tests.

See example Symfony project in integration test suite.

Recipes

MIT License

License can be found here.

Authors

The bundle was originally created by Yann Eugoné. See the list of contributors.


Thank's to PrestaConcept for supporting this bundle.


All versions of enum-bundle with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
symfony/framework-bundle Version ^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 yokai/enum-bundle contains the following files

Loading the files please wait ....