Download the PHP package yokai/doctrine-value-object without Composer

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

Value Objects for Doctrine ORM simplified

Tests Coverage Contributors

Latest Stable Version Downloads Monthly

This library offer you an easy way to handle value objects in a Doctrine ORM application.

It will save you the creation of Doctrine types for every different value object types you have.

Installation

Setup

You will have to register your value object types to the Doctrine type system.

If you are using Symfony, you can register your value object types in the kernel construction.

You can also leverage the power of attributes, along with olvlvl/composer-attribute-collector, to automatically register all your value objects at once.

Usage

After you completed setup you will be able to use your value object types type in any of your entities:

Value Object Types

Value objects are wrappers around existing doctrine types.

Let's see what wrappers exist and give you an example for each.

String

Imagine you have an application that stores phone numbers in database. You will often have to determine the country from which the number is originated.

You can centralize this logic in a PhoneNumber string value object. The object will be stored as a string in the database but hydrated back to this object by Doctrine.

See PhoneNumber code in tests.

DateTime

Imagine you have an application that stores users birthdate. You will often have to determine the age of the user, and put rules on this value.

You can centralize this logic in a Birthdate datetime value object. The object will be stored as datetime immutable in the database but hydrated back to this object by Doctrine.

See Birthdate code in tests.

Integer

Imagine you have an application that stores user status. You will often have to put rules on this value.

You can centralize this logic in a Status integer value object. The object will be stored as a integer in the database but hydrated back to this object by Doctrine.

See Status code in tests.

Object

:warning: If you are looking for value objects with multiple properties each stored in a table column: please use Doctrine Embeddables.

:warning: If you are looking for polymorphic value objects stored as JSON: please use dunglas/doctrine-json-odm.

Imagine you have an application that stores user notifications preferences. There is multiple information you want to store, as a JSON object.

You can centralize this logic in a Notifications object value object. The object will be stored as a json object in the database but hydrated back to this object by Doctrine.

See Notifications code in tests.

Collection

Imagine that you have an application that have to store multiple phone numbers in a property. You can centralize this type hinting in a PhoneNumbers collection value object.

The object will be stored as a json array in the database but hydrated back to this object by Doctrine.

See PhoneNumbers code in tests.

Contribution

Please feel free to open an issue or a pull request.

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

License

This library is under MIT LICENSE.


All versions of doctrine-value-object with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
doctrine/dbal Version ^3.8|^4.0
doctrine/orm Version ^2.7|^3.1
webmozart/assert Version ^1.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 yokai/doctrine-value-object contains the following files

Loading the files please wait ....