Download the PHP package andares/freedsl without Composer

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

FreeDSL 简介

一个简单的DSL生成器,可使用回调的方式生成DSL查询语句。

查询语句为elasticsearch的官方php包(composer: elasticsearch/elasticsearch)生成,未在其他elasticsearch客户端库中验证过。

创建新查询

每次创建一个新查询时new一个builder对象出来:

当查询参数设置完毕后通过invoke魔术方法获得生成的查询数组:

直接设置查询语句

利用属性重载进行直接参数设置,如根据id获取文档:

或者进行一次查询:

使用方法重载设置参数

使用方法可以更具扩展性的设置参数:

每次调用方法,会重置构造指针移动到查询语句的body根位置。此时每调用一次重载的虚拟方法都会向下推进一层。

除了魔术方法外,Builder对象只有,和这三个全小写的实体方法。其他的虚拟方法均通过重载用于构建dsl的键值。

push指令模式

有部分dsl指令的下级允许是一个数组,比如指令。如果不使用push模式,你不得不在中以参数形式传入一个数组来描述,如下所示:

使用push模式,可以使某些指令以数组形式添加子项,可以写成如下形式:

目前默认为push模式的指令有:

你也可以使用方法来添加需要使用push模式的指令:

创建带符号的查询指令

一些查询key值带符号不方便使用方法名使用方法可以创建带符号的查询

复杂一些的查询构建范例

以下是一个在当前项目中用到的聚合查询范例

yaml支持

builder类也支持使用yaml来描述查询语句的一部分,如下所示:


All versions of freedsl with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0.0
ext-yaml 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 andares/freedsl contains the following files

Loading the files please wait ....