Skip to content

deprecated-packages/symfony-route-usage

master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 

Detect Used and Unused Symfony Routes

Downloads total

Read about this package: How to Find Dead Symfony Routes


Inspired by Route Usage for Laravel:

"This package keeps track of all requests to know what controller method, and when it was called. The goal is not to build some sort of analytics but to find out if there are unused endpoints or controller method.

After a few years, any projects have dead code and unused endpoint. Typically, you removed a link on your frontend, nothing ever links to that old /special-page. You want to remove it, but you're not sure. Have look at the route_usage table and figure out when this page was accessed for the last time. Last week? Better keep it for now. 3 years ago? REMOVE THE CODE!"

Install

composer require symplify/symfony-route-usage

Register bundle to your config/bundles.php (in case Flex misses it):

return [
    Symplify\SymfonyRouteUsage\SymfonyRouteUsageBundle::class => [
        'all' => true,
    ],
];

Usage

Show used routes:

bin/console show-route-usage

Show dead routes:

bin/console show-dead-routes

Configuration

By default, _* and error_controller is excluded. If you want to exclude more routes, use regex parameter:

# config/services.yaml
parameters:
    route_usage_exclude_route_regex: '#legacy#'

Report Issues

In case you are experiencing a bug or want to request a new feature head over to the Symplify monorepo issue tracker

Contribute

The sources of this package are contained in the Symplify monorepo. We welcome contributions for this package on symplify/symplify.

About

[READ-ONLY] Detect used and unused Symfony routes

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages