Download the PHP package krzysztof-gzocha/searcher-bundle without Composer

On this page you can find all versions of the php package krzysztof-gzocha/searcher-bundle. 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 searcher-bundle

SearcherBundle Build Status Scrutinizer Code Quality Code Coverage SensioLabsInsight

This bundle is providing integration between Symfony and Searcher

What is Searcher?

Searcher is a library completely decoupled from any framework created in order to simplify construction of complex searching queries basing on passed criteria. It's basic idea is to split each searching filter to separate class. Regardless of what do you want to search: entities in MySQL, MongoDB or just files. Supported PHP versions: >=5.5, 7 and HHVM.

Full documentation

Full documentation can be found at http://searcher.rtfd.io/

Installation

You can install this bundle via composer

and don't forget to register it in your AppKernel:

Example usage

Config

In config file we will specify minimal configuration for people context.
You can full full example of config reference in here

As you can see you can specify everything as a simple class or as your own service. This configuration will create our people context and create all required services (builder collection, criteria collection, searcher and context), so you can access them and make use of them. For example to access Searcher instance from controller you can simply:

or to access age_range criteria:

or access my_criteria_builder:

I guess it's pretty easy to understand this naming convention. In this example you need to define only 1 service on your own - SearchingContext service with id specified in the config (your_searching_context_service_id). You can do it like this:

Code

For this example we will use simple AgeRangeCriteria (described in here), but of course you can use your own class or service.

We will also use AgeRangeCriteriaBuilder (described in here), but of course you can use your own class or service.

Form (optional)

Now we can create example form. Form will allow Symfony to take care of population and validation our criteria from request. This step is optional and you don't have to populate criteria from request. You can do this however you want to.

Controller

Wrapper class

By default SearcherBundle will wrap Searcher into WrappedResultsSearcher, which will return ResultCollection which has method getResults() that will return collection of your results. Of course ResultCollection itself is traversable, so you can use it inside foreach loop. This feature is useful in rare situations where you are not sure if your QueryBuilder will return array or traversable object. Returning null and trying to iterate over it will lead to an error. ResultCollection will prevent this kind of situation. If you want to change wrapper class then you need to specify wrapper_class in searcher config. Of course sometimes you want your Searcher to just return an integer or whatever, then you do not want to wrap your Searcher. In order to do that just specify wrapper_class as null

Chain searching

Searcher library allows you to perform chain searching and you can use with this bundle as well. All what you need to do is to properly configure it in config file and fetch ChainSearch service.

Example chain searching config:

With above config you can easily fetch all services like this:

Contributing

All ideas and pull request are welcomed and appreciated. Please, feel free to share your thought via issues.

Command to run tests: composer test.

License

License: MIT
Author: Krzysztof Gzocha


All versions of searcher-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5.9
symfony/framework-bundle Version >=2.3
krzysztof-gzocha/searcher Version ~4.0.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 krzysztof-gzocha/searcher-bundle contains the following files

Loading the files please wait ....