gnugat/redaktilo-bundle

Provides Redaktilo's Editor and TextFactory as services

v1.5.2 2015-12-01 17:48 UTC

This package is auto-updated.

Last update: 2024-11-05 20:29:04 UTC


README

Provides the following services from Redaktilo in a Symfony2 application:

Documentation:

SensioLabsInsight Travis CI

Extending

You can also extend Redaktilo by creating new SearchStrategy and new Command.

To make your custom Command and SearchStrategy available, simply define them as services in your Symfony2 application and tag them:

services:
    acme_redaktilo.custom_command:
        class: Acme\RedaktiloBundle\Command\CustomCommand
        tags:
            - { name: redaktilo.command }

    acme_redaktilo.custom_search_strategy:
        class: Acme\RedaktiloBundle\Search\SearchStrategy
        tags:
            - { name: redaktilo.search_strategy, priority: 20 }

Note: SearchStrategy's priority is optionnal (defaults to 0). The higher the priority is, the sooner SearchEngine will check if the SearchStrategy supports the given pattern.

Installation

Use Composer to install the bundle:

composer require gnugat/redaktilo-bundle:^1.0

Then register the bundle in you kernel. For example:

<?php
// File: app/AppKernel.php

use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;

class AppKernel extends Kernel
{
    public function registerBundles()
    {
        return array(
            new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
            new Gnugat\RedaktiloBundle\GnugatRedaktiloBundle(),
        );
    }

    public function registerContainerConfiguration(LoaderInterface $loader)
    {
        $loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
    }
}

Usage with Symfony2 DependencyInjection Component standalone

If you're not using the full stack framework, but rather just the Symfony2 DependencyInjection Component, you can still use this bundle:

<?php

use Gnugat\RedaktiloBundle\DependencyInjection\CommandCompilerPass;
use Gnugat\RedaktiloBundle\DependencyInjection\SearchStrategyCompilerPass;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;

$container = new ContainerBuilder();
$fileLocator = new FileLocator(__DIR__.'/vendor/gnugat/redaktilo/Resources/config');
$loader = new YamlFileLoader($container, $fileLocator);

$loader->load('services.yml');
$container->addCompilerPass(new SearchStrategyCompilerPass());
$container->addCompilerPass(new CommandCompilerPass());

Further documentation

You can see the current and past versions using one of the following:

You can find more documentation at the following links: