Download the PHP package bytesystems/number-sequence-generator without Composer

On this page you can find all versions of the php package bytesystems/number-sequence-generator. 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 number-sequence-generator

BytesystemsNumberGeneratorBundle

This bundle provides an annotation driven approach to generate number sequences for various use-cases, for example for invoices, offers, orders etc. For now it depends on doctrine\orm to store the sequences and doctrine\migrations to prepare your database.

Installation

$ composer require bytesystems/number-sequence-generator\ Prepare your database:\ $ symfony console doctrine:migrations:diff\ $ symfony console doctrine:migrations:migrate

If you don't want to add

No further configuration for the bundle is needed.\ To configure your sequences, use Annotations

Usage

To create a number sequence for an entity, annotate the property, that should be set to the generated number.

Annotation

Add the following use statement to your entity\ use Bytesystems\NumberGeneratorBundle\Annotation as NG;
and annotate the property with:\ @NG\Sequence(key="key",segment="segment",init=1000,pattern="IV{Y}-{#|6|y})

The resulting number will follow the pattern, in this case a generated number might look like: IV2021-004121

string key

mandatory\ Sequences will be generated and persisted automatically for the set key.

string segment

optional\ Offers the possibility to divide a sequence in segments. The segment uses the same values for key, pattern and init, but has its own counter. The segment can be provided as static string or as reference to another property of the entity. To define a reference use segment="{property}".

string pattern

optional, defaults to {#}\ The {#} token is mandatory and will be assumed, if pattern is omitted. The following tokens are available, date components follow PHP's datetime.format.

array segments

optional\ Defines an array of segment annotations with "value" and "pattern" properties. It allows to define a pattern for a segment of a sequence.

int init

optional, defaults to 0\ Defines the inital number for the sequence, the first generated number is initial number + 1.

About Segmentation

It is up to you, to define segmented sequences by yourself and persist them. This gives you flexibility to define dynamic sequences, that rely on another property from your entity.\ It falls back to default sequence unless you explicitly define the sequence manually.

Imagine the entity Product in your application. You want all products to have a number like:\ ACME-5123141-P\ But products from supplier Olymp should have their own article numbers like:\ ZEUS-41313-P\ The annotation achieving your goal would look like:\ Sequence(key="product",segment="{supplierId}",init=1000,pattern="ACME-{#|7}-P")\

This leaves it open to build an interface to mangage sequences and segments.

The resulting entity:

All products will have number like ACME-5123141-P\ Assuming the supplierId of Olymp is 42, enable the Olymp sequence using the following SQL statement:\ insert into bytesystems_number_sequence (sequence, segment, pattern, current_number, updated_at) values ('product','42', 'ZEUS-{#|5}-P',0,now());

If you have more information about segmentation during development, you can extend the annotation.

The segmented sequence can still be modified via sql or an interface, but there's no need to create SQL-statements to crate the segments.

ToDo

License

The MIT License (MIT)


All versions of number-sequence-generator with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
symfony/config Version ^6.0|^7.0
symfony/dependency-injection Version ^6.0|^7.0
doctrine/orm Version ^2.6
symfony/property-access Version ^6.0|^7.0
doctrine/migrations Version ^3.1
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 bytesystems/number-sequence-generator contains the following files

Loading the files please wait ....