Download the PHP package touhidurabir/eloquent-wherelike without Composer

On this page you can find all versions of the php package touhidurabir/eloquent-wherelike. 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 eloquent-wherelike

Laravel Eloquent WhereLike

An extended laravel eloquent WHERE method to work with sql LIKE operator.

Inspiration

The idea of this package comes from one of the Freek's Blog Post. I had developed this macro, which is a slightly different variation of what is described there and using it for years. So I have decided to release this as a package, so that I don't have to copy paste same code again and again and at the same time others can use this to save a little bit of their time.

Installation

Require the package using composer:

To publish the config file:

Configurations

The config file contains one important configuration option; the operator which defines the SQL operator that will be used to perform the query. By default it's set to LIKE, but you can update it as you see fit. For example, for PostgreSQL, it should be set to ILIKE.

Usage

As this whereLike method is defined as a macro, just use it like any eloquent method.

The first param will be the targeted columns to search for and second one is the actual search term.

One big advantage of this package is that is allows searches based on model relations. For example, say a user as one profile, and the profile table has first_name and last_name columns. In order to search users whose first name match, we can do following:

Here, notice the syntax

the initial dot(.) defines what is the relation, where the opeing and closing third bracked([]) define the columns of that relation model/table. In this example, we are also looking into the profile relations first_name and last_name columns.

A more advance example from one of my projects:

In the above example, we are searching for all campaigns based on, not only from campaigns table column, but from it's relation models' columns also.

Now, if we want to write the whole thing without using this package, we would have to write:

This whereLike saves us so much time this way! 🎉

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT


All versions of eloquent-wherelike with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
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 touhidurabir/eloquent-wherelike contains the following files

Loading the files please wait ....