Installing the Library¶
Note
RollerworksSearch is developed in a monolith repository, split into smaller components, which follow the same release cycle and versioning.
RollerworksSearch v1.0 is no longer maintained.
If you’re starting a new project (or already have a project) that will use one or more components, the easiest way to integrate everything is with Composer. Composer is smart enough to download the component(s) that you need and take care of autoloading so that you can begin using the libraries immediately.
This article will take you through using the core component, though this applies to using any component.
1. If you’re creating a new project, create a new empty directory for it.
2. Open a terminal and use Composer to grab the library.
$ composer require "rollerworks/search:^2.0"
The name rollerworks/search
is written at the top of the documentation for
whatever component you want.
Tip
Install Composer if you don’t have it already present on your system.
Depending on how you install, you may end up with a composer.phar
file in your directory. In that case, no worries! Your command line in that
case is php composer.phar require "rollerworks/search:^2.0"
.
3. Write your code!
Once Composer has downloaded the component(s), all you need to do is include
the vendor/autoload.php
file that was generated by Composer. This file
takes care of autoloading all of the libraries so that you can use them
immediately:
// File example: src/search.php
// update this to the path to the "vendor/"
// directory, relative to this file
require_once __DIR__.'/../vendor/autoload.php';
use Rollerworks\Component\Search\Searches;
$searchFactory = Searches::createSearchFactory();
$userFieldSetBuilder = $searchFactory->createFieldSetBuilder();
// ...
Note
When using a Framework integration the autoloading is already set-up by your framework bootstrapping.
Extensions¶
The rollerworks/search
core library itself does not provide any mechanise
for searching in a storage engine (like Doctrine or Elasticsearch). Instead they
are provided as separate libraries, called extensions.
Framework integration libraries (provided by Rollerworks) are designed to provide a clear-cut and ready to use solution. Whenever you install an addition extension, the integration automatically enables the support for it.
Note
Only extensions provided by Rollerworks are fully integrated, for extensions provided by third party developers you may need to enable some things manually.
Framework integration¶
RollerworksSearch provides full integration for:
- The Symfony Framework,
- The
Api Platform
, - Doctrine DBAL and ORM.
ElasticSearch
.