Download the PHP package poing/earmark without Composer

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

StyleCI Coverage Status

Earmark

A Laravel package to earmark sequential values in a series and eliminate any gaps in the series when values are unset. Allowing for values to be reused.

It can be used to fetch the next value (or array of values) to be used in an application. Database locking is used to prevent duplicate values from being returned.

An example...

Reserving the next available phone extension for a user. The phone extension can be reserved by the active session, preventing other sessions from obtaining the same value.

When a user leaves the phone extension can be recycled, the value can be unset(). Making the value available again for a future request.

Getting Started

1. Install EarMark

Run this at the command line:

This will update composer.json and install the package into the vendor/ directory.

2. Publish the EarMark Configuration File

To over-ride the default settings, initialize the config file by running this command:

Then open config/earmark.php and edit the settings to meet the requirements of your application.

3. Run the Migrations

Run the package migration files at the command line:

4. Recommended

This package is designed to use Laravel Queues, to defer the time consuming task of repopulating the available pool of values.

You may want to change the default QUEUE_CONNECTION to use another strategy. But the package also works with the default sync, but may cause latency in your application.

Settings

Hold Size

This is the number of series values that are kept in an available pool. Once the pool drops below a certain level, more values are added to the pool. This is where unused values are recycled.

Important:

Number Range

This package currently supports a minimal value. range.min will define the starting value of the series. Default: 2000

range.max may be used in the future.

Zero Padding

Allows the output value to be zero-padded, depending on the needs of the application.

Prefix & Suffix

Appends a prefix to the output value.

suffix may be used in the future.

How to Use

There are two ways to use this package:

Available Functions:

Simple Usage

With the values from the configuration file, use Earmarked::get() and Earmarked::unset().

You can also specify the number of values to return in an array:

Advanced Usage

You can initialize a new series using Earmark() and supplying the following variables:

The new series will not affect the default series, calling the series again (with the same parameters) will continue the numeric series.

How it works

Searching for gaps in a numerical series of numbers can be resource intensive. Depends on the size of the series.

This package uses two (2) tables, one for the series of used numbers and one to Hold a group of available numbers for immediate use. The package will get() the next consecutive number from the Hold table.

When the available numbers in the Hold table falls below one-third, this package will repopulate the Hold with more numbers. This package works best with Laravel queues.

Numbers in a series that have been unset() will be added to the Hold table for reuse when updated. Numbers in the Hold table are not sorted, unset() numbers will eventually be available again.

Additional Feature

Auto-Increment

Sometimes you just want the next number in an auto-increment series. One is included in this package. It does not support prefix, will not support suffix, but you can use zero-padding.

Do not use unset() with increment() values! You have been warned!

Contributing

Thinking of contributing?

  1. Fork & clone the project: git clone [email protected]:your-username/earmark.git.
  2. Run the tests and make sure that they pass with your setup: phpunit.
  3. Create your bugfix/feature branch and code away your changes. Add tests for your changes.
  4. Make sure all the tests still pass: phpunit.
  5. Push to your fork and submit new a pull request.

All versions of earmark with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
illuminate/console Version >=11.0
illuminate/database Version >=11.0
illuminate/events Version >=11.0
illuminate/filesystem Version >=11.0
illuminate/support Version >=11.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 poing/earmark contains the following files

Loading the files please wait ....