Download the PHP package vaened/php-search-engine without Composer

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

PHP Search Engine

The Search Library provides a fundamental and flexible foundation for building search engines in applications. This library is not tied to any specific ORM implementation; rather, it serves as the core upon which more complex search solutions can be built in other libraries that integrate with specific ORMs.

It offers a robust structure for handling common search functionalities, such as custom filters, text searches, and range management. Its modular design ensures efficient integration and the ability to extend to cover more sophisticated search needs as project requirements evolve.

Installation

PHP Search Engine requires PHP 8.1. To get the latest version, simply require the project using Composer:

Usage

This library provides a foundational framework for creating search engines. It includes the AbstractSearchEngine class as a base for custom search implementations and two key traits: Flaggable for filtering based on flags, and Indexable for search operations using indices. These components work together to offer a flexible and extensible solution for managing search criteria.

Search Engine

The library provides a base class called AbstractSearchEngine which offers fundamental functionality typically extended by other libraries for specific implementations. However, it's not mandatory to extend this class—custom implementations of SearchEngine can be created from scratch.

The key feature of AbstractSearchEngine is the apply method:

This method progressively builds search criteria based on applied filters, ultimately constructing the Criteria object.

Criteria

The criteria method is responsible for creating a Criteria instance that encapsulates all the search criteria:

This method calculates the pagination offset and initializes the Criteria object with the accumulated search criteria, order, and pagination details.

Flaggable Trait

The Flaggable trait adds the filter method to the SearchEngine, allowing you to apply filters based on specific flags. This method takes a FlagBag containing a set of flags and applies the corresponding filters. Each flag becomes a search criterion that is added to the engine.

Indexable Trait

The Indexable trait provides the search method, which allows you to perform searches based on a specific index. It uses an index defined by the BackedEnum and a queryString to search for the associated criterion in the index repository. If a valid criterion is found, it is applied to the search engine.

Concepts

Filters

Filters represent conditions applied during the search process. These filters are crucial for defining and refining search criteria according to specific requirements. Filters can be simple, such as a direct value check, or more complex, combining multiple conditions to restrict results in detail.

Example of internal definition

Flags

Flags are represented by classes that define binary filters, meaning they do not require additional parameters to determine whether a condition is met or not. These filters act as boolean indicators that apply predefined conditions without needing extra input values. Flags return a collection of filters based on the flag parameter provided.

Example of internal implementation

Indexes

Indexes are represented by classes that manage specific search indices. Each index is associated with a search criterion that is applied to a given value. The primary function of an Index is to return a single filter based on the provided index and value. This structure allows for optimized and precise searches using predefined indices.

Example of internal implementation

Usage

Design Principles

In the Search Library, each filter is treated as a separate PHP class with its own specific logic. This approach promotes order and cohesion in the design of the search system. By encapsulating filtering logic in separate classes, the code becomes easier to maintain and extend.

For instance, instead of having scattered filtering functions, classes like PersonId and PersonName are defined, each containing methods such as equals(value) or startsWith(value). This not only enhances code clarity but also enables more efficient reuse of filters in different contexts. By keeping filtering logic within dedicated classes, each filter has a single, well-defined responsibility, contributing to a cleaner and more organized design.

License

This library is licensed under the MIT License. For more information, please see the license file.


All versions of php-search-engine with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
vaened/php-criteria-core Version ^1.0
vaened/support 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 vaened/php-search-engine contains the following files

Loading the files please wait ....