diff --git a/Resources/config/routes.php b/Resources/config/routes.php
new file mode 100644
index 00000000..02ed632c
--- /dev/null
+++ b/Resources/config/routes.php
@@ -0,0 +1,7 @@
+add('oauth2_authorize', '/authorize')
+ ->controller(['league.oauth2_server.controller.authorization', 'indexAction'])
+
+ ->add('oauth2_token', '/token')
+ ->controller(['league.oauth2_server.controller.token', 'indexAction'])
+ ->methods(['POST'])
+ ;
+};
diff --git a/src/Resources/config/services.php b/config/services.php
similarity index 100%
rename from src/Resources/config/services.php
rename to config/services.php
diff --git a/src/Resources/config/storage/doctrine.php b/config/storage/doctrine.php
similarity index 100%
rename from src/Resources/config/storage/doctrine.php
rename to config/storage/doctrine.php
diff --git a/src/Resources/config/storage/in_memory.php b/config/storage/in_memory.php
similarity index 100%
rename from src/Resources/config/storage/in_memory.php
rename to config/storage/in_memory.php
diff --git a/docs/index.md b/docs/index.md
index 15ec971c..b02c6fe9 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -136,7 +136,7 @@ security:
```yaml
oauth2:
- resource: '@LeagueOAuth2ServerBundle/Resources/config/routes.php'
+ resource: '@LeagueOAuth2ServerBundle/config/routes.php'
type: php
```
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index 2d369183..9b5a7741 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -35,7 +35,6 @@
.
- ./resources
./tests
./vendor
diff --git a/src/DependencyInjection/LeagueOAuth2ServerExtension.php b/src/DependencyInjection/LeagueOAuth2ServerExtension.php
index 3655542f..a6070073 100644
--- a/src/DependencyInjection/LeagueOAuth2ServerExtension.php
+++ b/src/DependencyInjection/LeagueOAuth2ServerExtension.php
@@ -55,7 +55,7 @@ final class LeagueOAuth2ServerExtension extends Extension implements PrependExte
*/
public function load(array $configs, ContainerBuilder $container)
{
- $loader = new PhpFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
+ $loader = new PhpFileLoader($container, new FileLocator(__DIR__ . '/../../config'));
$loader->load('services.php');
$config = $this->processConfiguration(new Configuration(), $configs);
diff --git a/src/LeagueOAuth2ServerBundle.php b/src/LeagueOAuth2ServerBundle.php
index 7d070c8f..0478860b 100644
--- a/src/LeagueOAuth2ServerBundle.php
+++ b/src/LeagueOAuth2ServerBundle.php
@@ -54,4 +54,11 @@ private function configureDoctrineExtension(ContainerBuilder $container): void
$container->addCompilerPass(new EncryptionKeyPass());
}
+
+ public function getPath(): string
+ {
+ $reflected = new \ReflectionObject($this);
+
+ return \dirname($reflected->getFileName() ?: __FILE__, 2);
+ }
}
diff --git a/src/Resources/config/routes.php b/src/Resources/config/routes.php
index ddce95d1..6e9acc60 100644
--- a/src/Resources/config/routes.php
+++ b/src/Resources/config/routes.php
@@ -2,15 +2,6 @@
declare(strict_types=1);
-use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
+trigger_deprecation('league/oauth2-server-bundle', '0.11', 'Loading file "%s" is deprecated. Load "%s" instead.', __FILE__, realpath(__DIR__ . '/../../../config/routes.php'));
-return function (RoutingConfigurator $routes) {
- $routes
- ->add('oauth2_authorize', '/authorize')
- ->controller(['league.oauth2_server.controller.authorization', 'indexAction'])
-
- ->add('oauth2_token', '/token')
- ->controller(['league.oauth2_server.controller.token', 'indexAction'])
- ->methods(['POST'])
- ;
-};
+return require __DIR__ . '/../../../config/routes.php';
diff --git a/tests/Fixtures/routes.php b/tests/Fixtures/routes.php
index 2e4d7679..2218c548 100644
--- a/tests/Fixtures/routes.php
+++ b/tests/Fixtures/routes.php
@@ -6,7 +6,7 @@
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
return function (RoutingConfigurator $routes) {
- $routes->import('@LeagueOAuth2ServerBundle/Resources/config/routes.php');
+ $routes->import('@LeagueOAuth2ServerBundle/config/routes.php');
$routes
->add('security_test', '/security-test')