Skip to content

New directory structure #228

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Resources/config/routes.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

declare(strict_types=1);

trigger_deprecation('league/oauth2-server-bundle', '0.11', 'Loading resource "@LeagueOAuth2ServerBundle/Resources/config/routes.php" is deprecated. Load "@LeagueOAuth2ServerBundle/config/routes.php" instead.');

return require __DIR__ . '/../../config/routes.php';
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"league/oauth2-server": "^9.2",
"nyholm/psr7": "^1.4",
"psr/http-factory": "^1.0",
"symfony/deprecation-contracts": "^3",
"symfony/event-dispatcher": "^6.4|^7.0",
"symfony/filesystem": "^6.4|^7.0",
"symfony/framework-bundle": "^6.4|^7.0",
Expand Down
16 changes: 16 additions & 0 deletions config/routes.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

declare(strict_types=1);

use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;

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'])
;
};
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ security:

```yaml
oauth2:
resource: '@LeagueOAuth2ServerBundle/Resources/config/routes.php'
resource: '@LeagueOAuth2ServerBundle/config/routes.php'
type: php
```

Expand Down
1 change: 0 additions & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
<directory>.</directory>
</include>
<exclude>
<directory>./resources</directory>
<directory>./tests</directory>
<directory>./vendor</directory>
</exclude>
Expand Down
2 changes: 1 addition & 1 deletion src/DependencyInjection/LeagueOAuth2ServerExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 7 additions & 0 deletions src/LeagueOAuth2ServerBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
13 changes: 2 additions & 11 deletions src/Resources/config/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
2 changes: 1 addition & 1 deletion tests/Fixtures/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down