Download the PHP package mustafaomar/laravel-qsw without Composer

On this page you can find all versions of the php package mustafaomar/laravel-qsw. 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 laravel-qsw

Laravel query-string watcher

Cleanly apply filters on a query builder depending on query string parameters.

Sometimes you may want to apply additional logic on the query builder eg: loading some relationships so you can return that relations with the response depending on the query string parameters, or you may want to apply complex filters eg: status=active&with=comments,replies&from=2000-01-10&to=2022-05-25&sort=newest etc..

This package makes it easy to accomplish this with a great manner.

The main goal of using this package is the separation of concerns, we don't want tons of lines in our controllers.

Installation

You can install it via composer

Usage

There are serveral ways to start using laravel-qsw

Scopable trait

You can use Scopable in your model and we're done, you now have access to the watch scope, example.

Article.php

The last step we need is to create a scope, you can do so by using the following command.

For convention please use the model name followed by the query parameter you want to watch for, followed by Scope, for example ?status=success will be ArticleStatusScope.

This command will create a scope class similar to this:

Real-life use cases

Now let's create an example describes how to filter data with real-life example.

ArticleController.php

In this scope, we're gonna filter records which are between a date range.

Advanced

If for some reasons you don't want to use the watch keyword as a scope, you can create your own local scope.

in the following example we'll create a scope called scopes.

Article.php

Please don't get confused with scope and Scopes, scope is a word that tells Laravel we want to use the suffixed word (Scopes) to call when building a query with the query builder.


All versions of laravel-qsw with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2.5
laravel/framework Version ~7.0 || ~8.0 || ~9.0 || ~10.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 mustafaomar/laravel-qsw contains the following files

Loading the files please wait ....