Download the PHP package mobileka/scope-applicator without Composer

On this page you can find all versions of the php package mobileka/scope-applicator. 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 scope-applicator

Build Status Code Climate Coverage Status

ScopeApplicator brings an elegant way of sorting and filtering data to your PHP projects.

Overview

ScopeApplicator is an easy, logical and framework-agnostic way to achieve something like this:

/posts – returns a list of all posts

/posts?recent – returns only recent posts

/posts?author_id=5 – returns posts belonging to an author with an id=5

/posts?author_id=5&order_by_title=desc&status=active – returns only active posts belonging to an author with an id=5 and sorts them by a title in a descending order

Requirements

— php >= 5.4

Supported frameworks:

Installation

If you're using one of the supported frameworks, follow framework-specific installation instructions on its page.

Otherwise, you can install ScopeApplicator as follows:

composer require mobileka/scope-applicator 1.1.*

Usage

If you're using one of the supported frameworks, follow framework-specific usage instructions on its page.

Otherwise, you have to create a custom binding for your own framework or PHP-project.

TODO: add detailed instructions about bindings

Configuration options

ScopeApplicator supports several configuration options and these are described in this chapter.

Alias

Sometimes we don't want our users to see the actual scope name. Alias is a key that maps a URL query parameter to a scope name.

Example:

/posts?order_by_title – an orderByTitle scope will be applied

/posts?orderByTitle – no scope will be applied

Type

This option allows to cast a type of a parameter value before it will passed to a scope.

When type is set to bool or boolean, only 1 and true will be converted to true. Everything else is considered to be false.

If type is set to something different than bool or boolean, settype php function will be called.

Examples:

/posts?author_id=123sometext555 – a userId scope will be applied with integer 123 as an argument

/posts?new=true – a new scope will be applied with boolean true as its argument

/posts?new=yes – a new scope will be called with boolean false as its argument

Default

When this option is set, a scope will be applied on every single request, even when there are no query parameters in URL matching a scope name or alias.

Examples:

/posts?author_id=1 - a userId scope will be applied with 1 as an argument

/posts - a userId scope will be applied with 5 as an argument

Allow Empty

allowEmpty is used when an empty string should be passed to a scope as an argument. This option is set to false by default, so the empty string won't be passed to a scope.

Examples:

/posts?author_id – a userId scope will be applied with '' (empty string) as an argument.

Please note that when allowEmpty is set to false (what is a default behavior), you always have to provide a default value for the scope argument. Otherwise, the "Missing argument" exception will be thrown when /posts?author_id route is being hit.

Also note that when allowEmpty is set to true, a default value of a scope argument will be ignored and an empty string will be passed instead.

Keys (experimental)

Keys are used when a scope accepts multiple arguments.

Example:

/posts?created_at[from]=000-00-00&created_at[to]=2014-07-23 – a createdAt scope will be applied with '0000-00-00' as a first argument and '2014-07-23' as a second

Please note that I don't recommend using this right now as it's an experimental feature. Create two separate scopes instead (createdAtFrom and createAtTo) until this feature is marked as "stable".

Credits

Scope Applicator is inspired by has_scope Ruby gem.

Contributing

If you have noticed a bug or have suggestions, you can always create an issue or a pull request (use PSR-2). We will discuss the problem or a suggestion and plan the implementation together.

License

ScopeApplicator is an open-source software and licensed under the MIT License.


All versions of scope-applicator with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
mobileka/mosaic-array 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 mobileka/scope-applicator contains the following files

Loading the files please wait ....