Commit b14e6402 authored by Ludwig Ruderstaller's avatar Ludwig Ruderstaller

initial import

parents
<?php
namespace Cwd\Bundle\YoutubeBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
class DefaultController extends Controller
{
/**
* @Route("/hello/{name}")
* @Template()
*/
public function indexAction($name)
{
return array('name' => $name);
}
}
<?php
namespace Cwd\Bundle\YoutubeBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class CwdYoutubeBundle extends Bundle
{
}
<?php
namespace Cwd\Bundle\YoutubeBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
/**
* This is the class that validates and merges configuration from your app/config files
*
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class}
*/
class Configuration implements ConfigurationInterface
{
/**
* {@inheritdoc}
*/
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('cwd_youtube');
// Here you should define the parameters that are allowed to
// configure your bundle. See the documentation linked above for
// more information on that topic.
return $treeBuilder;
}
}
<?php
namespace Cwd\Bundle\YoutubeBundle\DependencyInjection;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Loader;
/**
* This is the class that loads and manages your bundle configuration
*
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
*/
class CwdYoutubeExtension extends Extension
{
/**
* {@inheritdoc}
*/
public function load(array $configs, ContainerBuilder $container)
{
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('services.yml');
}
}
<?php
namespace Cwd\Bundle\YoutubeBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class DefaultControllerTest extends WebTestCase
{
public function testIndex()
{
$client = static::createClient();
$crawler = $client->request('GET', '/hello/Fabien');
$this->assertTrue($crawler->filter('html:contains("Hello Fabien")')->count() > 0);
}
}
{
"name": "cwd/youtube-bundle",
"version": "0.0.1-alpha",
"description": "",
"keywords": ["symfony", "bundle"],
"type": "symfony-bundle",
"license": "MIT",
"authors": [
{
"name": "Ludwig Ruderstaller",
"email": "lr@cwd.at",
"homepage": "http://www.cwd.at"
}
],
"require": {
"php": ">=5.3",
"symfony/framework-bundle": ">2.3.0",
"symfony/symfony": "2.*",
"madcoda/php-youtube-api": "dev-master"
},
"autoload": {
"psr-0": {
"Cwd\\YoutubeBundle": ""
}
},
"target-dir": "Cwd/YoutubeBundle"
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment