Download the PHP package digital-craftsman/ids without Composer

On this page you can find all versions of the php package digital-craftsman/ids. 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 ids

Id handling with value objects in Symfony

A Symfony bundle to work with id and id list value objects in Symfony. It includes Symfony normalizers for automatic normalization and denormalization and Doctrine types to store the ids and id lists directly in the database.

As it's a central part of an application, it's tested thoroughly (including mutation testing).

Latest Stable Version PHP Version Require codecov Packagist Downloads Packagist License

Installation and configuration

Install package through composer:

It's recommended that you install the uuid PHP extension for better performance of id creation and validation. symfony/polyfill-uuid is used as a fallback. You can prevent installing the polyfill when you've installed the PHP extension.

Working with ids

Creating a new id

The bulk of the logic is in the Id class. Creating a new id is as simple as creating a new final readonly class and extending from it like the following:

Now you're already able to use it in your code like this:

Guard against invalid usages:

Or with a custom exception:

Symfony serializer

If you're injecting the SerializerInterface directly, there is nothing to do. The normalizer for the id is automatically registered.

This can be combined with the CQRS bundle to have serialized ids there.

Doctrine types

To use an id in your entities, you just need to register a new type for the id. Create a new class for the new id like the following:

Then register the new type in your config/packages/doctrine.yaml file:

Alternatively you can also add a compiler pass to register the types automatically.

Then you're already able to add it into your entity like this:

Working with id lists

Id lists are wrapper for an array of ids. They contain a few utility functions and improved type safety.

The IdList is immutable. Therefore, the mutation methods (like add, remove, ...) always return a new instance of the list.

Creating a new id list

The bulk of the logic is in the IdList class. Creating a new id list is as simple as creating a new final readonly class and extending from it like the following:

Now you're already able to use it in your code like this:

Guard against invalid usages:

Or with custom exception:

Symfony serializer

If you're injecting the SerializerInterface directly, there is nothing to do. The normalizer for the id list is automatically registered.

Doctrine types

To use an id list in your entities, you just need to register a new type for the id list. Create a new class for the new id list like the following:

Then register the new type in your config/packages/doctrine.yaml file:

Then you're already able to add it into your entity like this:

Additional documentation


All versions of ids with dependencies

PHP Build Version
Package Version
Requires php Version 8.2.*|8.3.*
symfony/framework-bundle Version ^6.3|^7.0
symfony/serializer Version ^6.3|^7.0
doctrine/dbal Version ^2.13.8|^3.3.6
symfony/polyfill-uuid Version ^1.26
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 digital-craftsman/ids contains the following files

Loading the files please wait ....