Download the PHP package angel-source-labs/laravel-expression-grammar without Composer

On this page you can find all versions of the php package angel-source-labs/laravel-expression-grammar. 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-expression-grammar

ExpressionGrammar

Grammar helper for providing expressions with grammar differences by database

Sometimes SQL expressions need to provide different grammar for different databases and for different versions of databases.

This package provides an ExpressionGrammar class that will produce the appropriate expression for the database and version in use.

For example, when Excel Seeder for Laravel tests exception messages, it can resolve the grammar based on the database used:

As another example, when working with ST_GeomFromText() between MySQL 8.0 vs MySQL 5.7 and Postgres, the order of latitude and longitude is different, and when switching between databases you might want your code base to work the same without changes. MySQL 8.0 provides an option for ST_GeomFromText() to change the axis order. So while the grammar for Postgres will look like ST_GeomFromText('POINT(1 2)', 4326), the grammar for MySql 8.0 will look like ST_GeomFromText('POINT(1 2)', 4326, 'axis-order=long-lat').

Creating an Expression with an ExpressionGrammar to support these three different grammars would look like this:

This will resolve to the following expressions for the specified databases and versions:

database version result
MySQL default ST_GeomFromText('POINT(1 2)', 4326)
MySQL 8.0 and higher ST_GeomFromText('POINT(1 2)', 4326, 'axis-order=long-lat')
Postgres default ST_GeomFromText('POINT(1 2)', 4326)

Laravel Expressions do not support bindings by default. Expressions for Laravel is a package that provides Expressions that support bindings, which allows the ExpressionGrammar helper to return Expressions with bindings that will be evaluated by the query builder.

Available Methods

The ExpressionGrammar class provides a fluent interface for adding grammar expressions and has methods for each built-in Laravel driver as well as a generic grammar method that allows specifying a driver string for other databases.

ExpressionGrammar::make()

Creates a new Grammar instance and provides a fluent interface for adding grammar expressions.

ExpressionGrammar->mySql($string, $version (optional))

Add an expression for MySQL grammar.

ExpressionGrammar->postgres($string, $version (optional))

Add an expression for Postgres grammar.

ExpressionGrammar->sqLite($string, $version (optional))

Add an expression for SQLite grammar.

ExpressionGrammar->sqlServer($string, $version (optional))

Add an expression for SqlServer grammar.

ExpressionGrammar->grammar($driver, $string, $version (optional))

Add an expression for grammar for other database drivers. $driver should match the driver string used by the Laravel query builder driver. For example $grammar->postgres("ST_GeomFromText('POINT(1 2)', 4326)") is equivalent to $grammar->grammar("pgsql", "ST_GeomFromText('POINT(1 2)', 4326)").

The $version parameter is optional. When not specified, the grammar applies as the default. When specified, the grammar applies to the specified version of the database or greater.

ExpressionGrammar will throw a GrammarNotDefinedForDatabaseException if the Query Builder attempts to resolve an Expression for a Grammar that has not been defined for that database driver.

License

ExpresionGrammar for Laravel is open-sourced software licensed under the MIT license.


All versions of laravel-expression-grammar with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1.3
laravel/framework Version >=5.8
ext-pdo Version *
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 angel-source-labs/laravel-expression-grammar contains the following files

Loading the files please wait ....