Download the PHP package zlikavac32/php-enum-doctrine without Composer

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

PHP Enum Doctrine

Build Status Latest Stable Version License Scrutinizer Code Quality Codacy Badge

Doctrine support for zlikavac32/php-enum.

Table of contents

  1. Installation
  2. Usage
    1. Custom column length
    2. Custom representation
  3. Limitations
  4. Further work

Installation

Recommended installation is through Composer.

Usage

Assumption is that there exists a valid enum \YesNoEnum.

Create a new type that extends \Zlikavac32\DoctrineEnum\DBAL\Types\EnumType.

Next, define protected function enumClass(): string. This method should return FQN of the enum class that this type exposes to the Doctrine.

Define Doctrine method public function getName(): string that defines type's name.

And that's it. Only thing left to do is to register the type using

You can now use enum_yes_no type.

For more info on the custom Doctrine mapping types, check official documentation.

Custom column length

Internally this library uses varchar type with the maximum length of 32. If you want to fit the length to your own needs, just override method protected function columnLength(): int.

Note that on types first usage, all enum elements names are checked against specified column length. If a name longer than maximum length is detected, a \LogicException is thrown.

Custom representation

By default, name of the enum element is used for it's representation in the database. To change that behaviour, override methods enumToDatabaseValue() and databaseValueToEnum().

Limitations

This library does not use platform dependent types like enum in MySQL or custom types in PostgresSQL. Instead, varchar is used.

Reasons for this are:

If you know how to avoid any of this, please let me know.

Further work

Figure out how to overcome issues in Limitations.


All versions of php-enum-doctrine with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4
zlikavac32/php-enum Version ^3.0
doctrine/dbal Version ^2.10
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 zlikavac32/php-enum-doctrine contains the following files

Loading the files please wait ....