opale/externaluribundle

Build Uri that goes outside of your symfony application

1.1.3 2016-01-14 17:10 UTC

This package is not auto-updated.

Last update: 2020-08-03 06:53:24 UTC


README

INSTALLATION via Composer

composer require opale/externaluribundle

CONFIGURATION

Register the bundle:

<?php
// app/AppKernel.php
public function registerBundles()
{
    $bundles = array(
        // ...
        new Opale\ExternalUriBundle\OpaleExternalUriBundle(),
    );
    // ...
}

Add external routes in a config file (ex.: externalRouting.yml)

xternal_url_key:
    scheme: "https"
    path: /path/{configurationId}
    host: %acme_example.service_url%

Add your externalRouting.yml in the config.yml

# Opale ExternalUriGenerator configuration    
opale_external_uri:
    resources: 
        - { resource: %kernel.root_dir%/../src/Acme/MyBundle/Resources/config/externalRouting.yml }

USAGE

TWIG

{{ externalUrl(xternal_url_key, {configurationId: 103}) }}
... or
{{ externalUrl(xternal_url_key) }}

Service

Call the service opale_external_uri.generator

$this->get('opale_external_uri.generator')->generate('xternal_url_key', ['configurationId' => 103]);