Download the PHP package slava-basko/specification-php without Composer

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

Encapsulate your business decisions for readable, clear, and maintainable purposes. In simpler words: encapsulate your business's IF's and ELSE's, and speak with clients on the same language.

Read it if you are not familiar with Specification pattern [http://www.martinfowler.com/apsupp/spec.pdf].

This library has no dependencies on any external libs and works on PHP 5.5+. Why? Because legacy projects still exists, and they also want some structure.

Install

Usage

Let's imagine that we have the specification of an Adult Person.

Now let's check if the user is actually an adult.

Use TypedSpecification decorator/wrapper if you want typed specification.

TypedSpecification VS public function isSatisfiedBy(User $candidate)

Of course, you can create your own specification interfaces with type hinting in isSatisfiedBy, but sooner or later you will see a lot of interfaces that are similar by 99%.

Or you can use TypedSpecification decorator to achieve the same goal.

Autocompletion

Use the doc-block type hinting in your end specifications for autocompletion, like @param User $candidate.

TypedSpecification guaranty that $candidate will be an instance of User class, and doc-block @param User $candidate helps your IDE to autocomplete $candidate methods.

Composition

This lib provides useful builtin specifications like NotSpecification, AndSpecification, OrSpecification, etc. (https://en.wikipedia.org/wiki/Logical_connective) that helps you to group up your specifications and create a new one.

Here is another example that shows how highly composable specifications could be.

Remainders

Method isSatisfiedBy returns bool, and sometimes in case of false you want to know what exactly has gone wrong. Use remainderUnsatisfiedBy method for that. It returns a remainder of unsatisfied specifications.

You can use Utils to convert it to useful array.

For example, you can use strings inside $remainder like high_value_parcel as a translation key to show meaningful error message.

License

Use as you want. No liability or warranty from me. Can be considered as MIT.


All versions of specification-php with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5|^7|^8
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 slava-basko/specification-php contains the following files

Loading the files please wait ....