Download the PHP package ngmy/specification without Composer

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

日本語

PHP Specification

test coverage

This is a library to help implement the specification pattern in PHP.
It provides on-memory validation, on-memory and ORM selection, and specification composite.

Installation

Usage

Specification creation and on-memory validation and selection

Create your specification class by inheriting from the AbstractSpecification class.

Then implement the isSatisfiedBy method.
In this method, write the criteria that satisfy the specification.

In addition, use the @extends annotation to write the object type expected by the isSatisfiedBy method to facilitate static analysis.

By calling the isSatisfiedBy method with the object to be verified, you can verify that the object satisfies the specification.

Of course, it can also be used for selection.

ORM selection

Eloquent

Implement the applyToEloquent method.
Write the selection criteria in this method using the where method, etc.

By calling the applyToEloquent method passing the Eloquent builder, you can add selection criteria to the query.

Doctrine

Implement the applyToDoctrine method.
Write the selection criteria in this method using the andWhere method, etc.

By calling the applyToDoctrine method passing the query builder, you can add selection criteria to the query.

Composite

You can compose specifications with AND, OR, and NOT.
When composing a specification, the criteria writed in the isSatisfiedBy, applyToEloquent and applyToDoctrine methods are also composited.

AND

By passing an instance of another specification to the specification's and method and calling it, you can generate a new specification that is an AND composite of the two specifications.

OR

By passing an instance of another specification to the specification's or method and calling it, you can generate a new specification that is an OR composite of the two specifications.

NOT

By calling the not method of the specification, you can generate a new specification that is NOT composite of itself.

Example of use

License

PHP Specification is open-sourced software licensed under the MIT license.


All versions of specification with dependencies

PHP Build Version
Package Version
Requires php Version ^8.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 ngmy/specification contains the following files

Loading the files please wait ....