Download the PHP package liip/search-bundle without Composer

On this page you can find all versions of the php package liip/search-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?
liip/search-bundle
Rate from 1 - 5
Rated 5.00 based on 1 reviews

Informations about the package search-bundle

LiipSearchBundle

Latest Stable Version Latest Unstable Version Total Downloads

This bundle provides a uniform interface for full text search with various search engines and a controller with twig templates to render search forms and results.

Note: You are looking at Version 2 of this bundle, which saw large changes compared to Version 1.

Introduction

This search bundle simplifies adding search to your site.

Provided for you are:

Built-in Search Engines Support

For now, Google site search is supported out of the box. There is one implementation using the Google REST API and one implementation using the Custom Search Element feature that loads the search with only javascript in the frontend.

Contributions for other services are welcome.

Installation

Install the bundle with composer require liip/search-bundle.

Include the bundle in app/Kernel.php.

Add your preferred search engine in app/config/config.yml:

Or if you use the javascript Google custom search engine:

Usage

You can display a search box anywhere on the page with the liip_search_box twig function:

You can customize the search box with these parameters:

Create a route for the search action. The easiest is to just use the provided routing.xml from your main project routing.xml:

It defaults to the URL /search. If you want a different route, use the prefix option when including the route or configure your own route using %liip_search.controller.search_action% as default value for _controller.

Customizing Templating

The search result templates provided by this bundle extend the LiipSearchBundle::layout.html.twig template. To integrate with the rest of your site, you have two options:

Of course you can also override any of the templates to customize what they should do. See http://symfony.com/doc/master/book/templating.html#overriding-bundle-templates

Configuration Reference

This is the full reference of what you can configure under the liip_search key:

search_factory

string, default value: null

Specify a custom service that implements the Liip\SearchBundle\SearchFactoryInterface. This service will be used by the controller to create Pagerfanta instances to handle the search.

If you configure one of the search engine services, you do not need to set this field.

search_route

string, default value: liip_search

The name of the route that will handle submitted search requests.

restrict_language

boolean, default value: false

Change this to true if you want to ask the search service to restrict the results to the language of the request.

Google Search REST API Integration

Configuring any of these options enables the google search engine service. They are located under clients.google_rest.

api_key

string, required

Your Google API key

search_key

string|array, required

The key identifying your Google Search Engine. May be a list of keys indexed by locale to use different engines per locale. If you control locales through separate search engines, you do not need to set restrict_language to true unless you want your custom search engines to receive a language restriction additionally.

api_url

string, default value: https://www.googleapis.com/customsearch/v1

The Google Search API URL for REST calls

restrict_to_site

string, default value: null

If left empty, all sites configured for the google search engines are searched. Set to a a domain to limit to that domain.

Google Custom Search Engine Integration

Configuring this section activates a different controller that renders the Javascript fragment to enable the CSE search. This configuration is located under clients.google_cse.

cse_id

string|array, required

The key identifying your Google Custom Search Engine. May be a list of keys indexed by locale to use different engines per locale. CSE does not support the restrict_language, so different search engines per language are your only option to restrict the language of search results.

Troubleshooting

Google Custom Search Engine

If you get SearchException saying "Empty response received from Google Search Engine API", try copying the URL that is output into a browser. You should get JSON response, but likely it will haves an error status.

If you get a status 500 with an empty message, chances are that you need to renew the search engine in the Google admin panel.

Adding your own Search Service

Implement the Liip\SearchBundle\SearchInterface and configure it as a service. Then set liip_search.search_client to that service name.

TODO


All versions of search-bundle with dependencies

PHP Build Version
Package Version
Requires php Version ^5.3.9|^7.0
symfony/framework-bundle Version ~2.3|~3.0
white-october/pagerfanta-bundle Version ~1.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 liip/search-bundle contains the following files

Loading the files please wait ....