Skip to content

Commit

Permalink
create extension
Browse files Browse the repository at this point in the history
  • Loading branch information
yosrib committed May 24, 2023
1 parent fc7e9f8 commit b617359
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 11 deletions.
9 changes: 0 additions & 9 deletions DevgineDemoBundle.php

This file was deleted.

11 changes: 9 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,24 @@
"require": {
"php": ">=8.1",
"symfony/console": "^6.1",
"symfony/http-kernel": "^6.1"
"symfony/http-kernel": "^6.1",
"symfony/dependency-injection": "^6.1",
"symfony/config": "^6.1"
},
"license": "MIT",
"autoload": {
"psr-4": {
"Devgine\\Demo\\": ""
"Devgine\\Demo\\": "src/"
},
"exclude-from-classmap": [
"/Tests/"
]
},
"autoload-dev": {
"psr-4": {
"Devgine\\Demo\\Tests\\": "tests/"
}
},
"authors": [
{
"name": "Yosri BAHRI",
Expand Down
File renamed without changes.
21 changes: 21 additions & 0 deletions src/DependencyInjection/DevgineDemoExtension.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

namespace Devgine\Demo\DependencyInjection;

use Symfony\Component\Console\Application;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\Extension;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\Config\FileLocator;

class DevgineDemoExtension extends Extension
{
public function load(array $configs, ContainerBuilder $container)
{
$loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));

if (class_exists(Application::class)) {
$loader->load('console.xml');
}
}
}
10 changes: 10 additions & 0 deletions src/DevgineDemoBundle.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace Devgine\Demo;

use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\AbstractBundle;

class DevgineDemoBundle extends AbstractBundle
{
}
13 changes: 13 additions & 0 deletions src/Resources/config/console.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" ?>

<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">

<services>
<service id="devgine_demo.hello_console" class="Lexik\Bundle\JWTAuthenticationBundle\Command\CheckConfigCommand">
<tag name="console.command" command="devgine:demo:hello" />
</service>
</services>

</container>
File renamed without changes.

0 comments on commit b617359

Please sign in to comment.