Skip to content

Instantly share code, notes, and snippets.

View ikwattro's full-sized avatar

Christophe Willemsen ikwattro

View GitHub Profile
@ikwattro
ikwattro / composer.json
Created September 14, 2014 21:35
bootstrap - composer
{
"require": {
"php": ">=5.4",
"symfony/dependency-injection": "~2.5.0",
"symfony/config": "~2.5.0",
},
"autoload": {
"psr-0": {
"Acme": "src/"
}
@ikwattro
ikwattro / directory-structure.txt
Last active August 29, 2015 14:06
bootstrap - dir structr
- src/
-- Acme/
--- Command/
---- GetRootCommand.php
---- PostHelloCommand.php
--- Connection/
---- SingleConnection.php
--- DependencyInjection/
---- AcmeExtension.php
---- Configuration.php
@ikwattro
ikwattro / config.yml
Last active August 29, 2015 14:06
boostrap user config file
/config.yml
acme:
connections:
default:
scheme: http
host: localhost
port: 1234
server2:
scheme: https
@ikwattro
ikwattro / services.yml
Last active August 29, 2015 14:06
bootstrap service definitions
# Resources/config/services.yml
services:
acme.connection_manager:
class: "Acme\\Manager\\ConnectionManager"
acme.command_manager:
class: "Acme\\Manager\\CommandManager"
@ikwattro
ikwattro / commands.yml
Last active August 29, 2015 14:06
bootstraps
# Resources/config/commands.yml
commands:
get_root:
class: "Acme\\Command\\GetRootCommand"
post_hello:
class: "Acme\\Command\\PostHelloCommand"
@ikwattro
ikwattro / application.php
Last active August 29, 2015 14:06
Application
<?php
use Symfony\Component\DependencyInjection\ContainerBuilder,
Symfony\Component\Yaml\Yaml;
use Acme\DependencyInjection\AcmeExtension;
class Application
{
private $container;
@ikwattro
ikwattro / extension.php
Last active August 29, 2015 14:06
extension
<?php
namespace Acme\DependencyInjection;
use Symfony\Component\DependencyInjection\ContainerBuilder,
Symfony\Component\DependencyInjection\Loader\YamlFileLoader,
Symfony\Component\DependencyInjection\Extension\ExtensionInterface,
Symfony\Component\Config\Definition\Processor,
Symfony\Component\Config\FileLocator,
use Acme\DependencyInjection\Configuration.php
@ikwattro
ikwattro / simple_get.php
Created September 15, 2014 13:06
get application
<?php
require 'vendor/autoload.php';
$app = new \Acme\Application;
$app->build(__DIR__.'/my_config.yml');
$connectionManager = $app->getConnectionManager();
@ikwattro
ikwattro / structure
Created September 15, 2014 13:17
dir structure 2
- src/
-- Acme/
--- Command/
---- GetRootCommand.php
---- PostHelloCommand.php
--- Connection/
---- SingleConnection.php
--- DependencyInjection/
---- AcmeExtension.php
---- Configuration.php
@ikwattro
ikwattro / AcmeBundle.php
Created September 15, 2014 13:19
bundle class
<?php
use Symfony\Component\HttpKernel\Bundle\Bundle,
Symfony\Component\DependencyInjection\ContainerBuilder;
class AcmeBundle extends Bundle
{
public function build(ContainerBuilder $container)
{
parent::build($container);