Skip to content

Installation

Symftony edited this page Dec 10, 2017 · 1 revision

Installation

Installation as library

The recommended way to install Xpression is through Composer.

# Install Composer
curl -sS https://getcomposer.org/installer | php
php composer require symftony/xpression

After installing, you need to require Composer's autoloader:

require 'vendor/autoload.php';

Installation as bundle

Xpression Bundle

php composer require symftony/xpression-bundle

After you have installed the package, you just need to add the bundle to your AppKernel.php file:

// in AppKernel::registerBundles()
$bundles = array(
    // ...

    new Symftony\XpressionBundle\XpressionBundle()
    // ...
);

The bundle provide a controller annotation

@Xpression(
    expressionBuilder="odm"     //chose the expression builder orm/odm/common/closure
    source="query"              //OPTIONNAL choose request parameter bag
    sourceName="query"          //OPTIONNAL choose request parameter name
    targetName="query"          //OPTIONNAL choose controller target name
    allowedTokenType=Lexer::ALL //OPTIONNAL choose token type allowed
)
    /**
     * @Xpression(expressionBuilder="odm")
     */
    public function myAction($query)
    {
        //use $query here
        //...
    }
Clone this wiki locally