Download the PHP package igdr/doctrine-specification without Composer

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

Doctrine Specification

This library gives you a new way for writing queries. Using the [Specification pattern][wiki_spec_pattern] you will get small Specification classes that are highly reusable.

The problem with writing Doctrine queries is that it soon will be messy. When your application grows you will have 20+ function in your Doctrine repositories. All with long and complicated QueryBuilder calls. You will also find that you are using a lot of parameters to the same method to accommodate different use cases.

After a discussion with Kacper Gunia on [Sound of Symfony podcast][sos] about how to test your Doctrine repositories properly, we (Kacper and Tobias) decided to create this library. We have been inspired by Benjamin Eberlei's thoughts in his [blog post][whitewashing].

Table of contents

  1. basic understanding (this page)
  2. [Usage examples][doc-usage]
  3. [Create your own spec][doc-create]
  4. [Contributing to the library][contributing]

Why do we need this lib?

You are probably wondering why we created this library. Your entity repositories are working just fine as they are, right?

But if your friend open one of your repository classes he/she would probably find that the code is not as perfect as you thought. Entity repositories have a tendency to get messy. Problems may include:

Requirements of the solution

The solution should have the following features:

The practical differences

This is an example of how you use the lib. Say that you want to fetch some Adverts and close them. We should select all Adverts that have their endDate in the past. If endDate is null make it 4 weeks after the startDate.

Yes, it looks pretty much the same. But the later is reusable. Say you want another query to fetch Adverts that we should close but only for a specific company.

Doctrine Specification

QueryBuilder

If you were about to do the same thing with only the QueryBuilder it would look like this:

Configuration

Edit your doctrine settings to register default repository

The issues with the QueryBuilder implementation are:


All versions of doctrine-specification with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1
doctrine/orm Version ^2.6
symfony/property-access Version ^4.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 igdr/doctrine-specification contains the following files

Loading the files please wait ....