forked from garygreen/pretty-routes
-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from andrey-helldar/upgrade
Upgrade to self-contained
- Loading branch information
Showing
13 changed files
with
339 additions
and
61 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
preset: psr12 | ||
|
||
risky: true | ||
|
||
enabled: | ||
- align_double_arrow | ||
- align_equals | ||
- align_phpdoc | ||
- alpha_ordered_imports | ||
- binary_operator_spaces | ||
- blank_line_before_continue | ||
- blank_line_before_declare | ||
- blank_line_before_return | ||
- blank_line_before_throw | ||
- blank_line_before_try | ||
- cast_spaces | ||
- combine_consecutive_issets | ||
- const_separation | ||
- dir_constant | ||
- fully_qualified_strict_types | ||
- logical_operators | ||
- method_separation | ||
- no_alias_functions | ||
- no_blank_lines_after_phpdoc | ||
- no_blank_lines_between_traits | ||
- no_empty_comment | ||
- no_empty_phpdoc | ||
- no_extra_block_blank_lines | ||
- no_extra_consecutive_blank_lines | ||
- no_short_bool_cast | ||
- no_trailing_comma_in_singleline_array | ||
- no_unneeded_control_parentheses | ||
- no_unused_imports | ||
- ordered_class_elements | ||
- php_unit_construct | ||
- php_unit_fqcn_annotation | ||
- phpdoc_indent | ||
- phpdoc_inline_tag | ||
- phpdoc_link_to_see | ||
- phpdoc_no_access | ||
- phpdoc_no_empty_return | ||
- phpdoc_no_package | ||
- phpdoc_no_useless_inheritdoc | ||
- phpdoc_order | ||
- phpdoc_property | ||
- phpdoc_return_self_reference | ||
- phpdoc_scalar | ||
- phpdoc_separation | ||
- phpdoc_summary | ||
- phpdoc_to_comment | ||
- phpdoc_trim | ||
- phpdoc_type_to_var | ||
- phpdoc_types | ||
- phpdoc_types_order | ||
- phpdoc_var_without_name | ||
- property_separation | ||
- self_accessor | ||
- short_array_syntax | ||
- short_list_syntax | ||
- single_line_class_definition | ||
- single_line_throw | ||
- single_quote | ||
- space_after_semicolon | ||
- standardize_not_equals | ||
- ternary_to_null_coalescing | ||
- trailing_comma_in_multiline_array | ||
- trim_array_spaces |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,28 @@ | ||
{ | ||
"name": "garygreen/pretty-routes", | ||
"description": "Pretty routes for Laravel 5.", | ||
"name": "andrey-helldar/pretty-routes", | ||
"description": "Pretty routes for Laravel 6+", | ||
"require": { | ||
"laravel/framework": "5.*|6.*|7.*" | ||
"php": "7.2", | ||
"doctrine/annotations": "^1.0", | ||
"laravel/framework": "^6.0|^7.0|^8.0" | ||
}, | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Gary Green", | ||
"email": "[email protected]" | ||
}, | ||
{ | ||
"name": "Andrey Helldar", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"autoload": { | ||
"psr-4": { | ||
"PrettyRoutes\\": "src" | ||
} | ||
}, | ||
"minimum-stability": "dev", | ||
"minimum-stability": "stable", | ||
"extra": { | ||
"laravel": { | ||
"providers": [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,34 @@ | ||
<?php | ||
|
||
return [ | ||
|
||
/** | ||
/* | ||
* The endpoint to access the routes. | ||
*/ | ||
'url' => 'routes', | ||
'url' => 'routes', | ||
|
||
/** | ||
/* | ||
* The middleware(s) to apply before attempting to access routes page. | ||
*/ | ||
'middlewares' => [], | ||
'middlewares' => [], | ||
|
||
/** | ||
/* | ||
* Indicates whether to enable pretty routes only when debug is enabled (APP_DEBUG). | ||
*/ | ||
'debug_only' => true, | ||
'debug_only' => true, | ||
|
||
/** | ||
/* | ||
* The methods to hide. | ||
*/ | ||
'hide_methods' => [ | ||
'hide_methods' => [ | ||
'HEAD', | ||
], | ||
|
||
/** | ||
/* | ||
* The routes to hide with regular expression | ||
*/ | ||
'hide_matching' => [ | ||
'#^_debugbar#', | ||
'#^_ignition#', | ||
'#^routes$#' | ||
'#^routes$#', | ||
], | ||
|
||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
|
||
use Illuminate\Support\Facades\Route; | ||
|
||
Route::name('pretty-routes.show') | ||
->middleware(config('pretty-routes.middlewares')) | ||
->get(config('pretty-routes.url'), 'PrettyRoutes\PrettyRoutesController@show'); |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace PrettyRoutes\Facades; | ||
|
||
use Illuminate\Support\Facades\Facade; | ||
use PrettyRoutes\Support\Annotation as Support; | ||
|
||
/** | ||
* @method static boolean isDeprecated(string $controller, string $method = null) | ||
* @method static boolean isDeprecatedClass(string $controller) | ||
* @method static boolean isDeprecatedMethod(string $controller, string $method) | ||
*/ | ||
class Annotation extends Facade | ||
{ | ||
protected static function getFacadeAccessor() | ||
{ | ||
return Support::class; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,29 @@ | ||
<?php namespace PrettyRoutes; | ||
<?php | ||
|
||
use Route; | ||
use Closure; | ||
namespace PrettyRoutes; | ||
|
||
class PrettyRoutesController { | ||
use Closure; | ||
use Illuminate\Routing\Controller as BaseController; | ||
use PrettyRoutes\Support\Routes; | ||
|
||
class PrettyRoutesController extends BaseController | ||
{ | ||
/** | ||
* Show pretty routes. | ||
* | ||
* @param \PrettyRoutes\Support\Routes $routes | ||
* | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function show() | ||
public function show(Routes $routes) | ||
{ | ||
$middlewareClosure = function ($middleware) { | ||
return $middleware instanceof Closure ? 'Closure' : $middleware; | ||
}; | ||
|
||
$routes = collect(Route::getRoutes()); | ||
|
||
foreach (config('pretty-routes.hide_matching') as $regex) { | ||
$routes = $routes->filter(function ($value, $key) use ($regex) { | ||
return !preg_match($regex, $value->uri()); | ||
}); | ||
} | ||
|
||
return view('pretty-routes::routes', [ | ||
'routes' => $routes, | ||
'routes' => $routes->get(), | ||
'middlewareClosure' => $middlewareClosure, | ||
]); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,40 @@ | ||
<?php namespace PrettyRoutes; | ||
<?php | ||
|
||
use Route; | ||
use Illuminate\Support\ServiceProvider as IlluminateServiceProvider; | ||
namespace PrettyRoutes; | ||
|
||
class ServiceProvider extends IlluminateServiceProvider { | ||
use Illuminate\Support\ServiceProvider as BaseServiceProvider; | ||
|
||
/** | ||
* Register. | ||
* | ||
* @return | ||
*/ | ||
class ServiceProvider extends BaseServiceProvider | ||
{ | ||
public function register() | ||
{ | ||
// | ||
} | ||
if ($this->isDisabled()) { | ||
return; | ||
} | ||
|
||
/** | ||
* Boot. | ||
* | ||
* @return void | ||
*/ | ||
public function boot() | ||
{ | ||
$this->mergeConfigFrom( | ||
__DIR__ . '/../config.php', 'pretty-routes' | ||
__DIR__ . '/../config/pretty-routes.php', | ||
'pretty-routes' | ||
); | ||
} | ||
|
||
if (config('pretty-routes.debug_only', true) && empty(config('app.debug'))) { | ||
public function boot() | ||
{ | ||
if ($this->isDisabled()) { | ||
return; | ||
} | ||
|
||
$this->loadViewsFrom(realpath(__DIR__ . '/../views'), 'pretty-routes'); | ||
$this->loadViewsFrom(realpath(__DIR__ . '/../resources/views'), 'pretty-routes'); | ||
|
||
$this->publishes([ | ||
__DIR__ . '/../config.php' => config_path('pretty-routes.php') | ||
__DIR__ . '/../config/pretty-routes.php' => config_path('pretty-routes.php'), | ||
]); | ||
|
||
Route::get(config('pretty-routes.url'), 'PrettyRoutes\PrettyRoutesController@show') | ||
->name('pretty-routes.show') | ||
->middleware(config('pretty-routes.middlewares')); | ||
$this->loadRoutesFrom(__DIR__ . '/../routes/web.php'); | ||
} | ||
|
||
protected function isDisabled(): bool | ||
{ | ||
return config('pretty-routes.debug_only', true) && empty(config('app.debug')); | ||
} | ||
} |
Oops, something went wrong.