symplify/symfony-route-usage

This package is abandoned and no longer maintained. The author suggests using the 50bhan/symfony-route-usage package instead.

Detect used and unused Symfony routes

Maintainers

👁 TomasVotruba

Package info

github.com/deprecated-packages/symfony-route-usage

Type:symfony-bundle

pkg:composer/symplify/symfony-route-usage

Statistics

Installs: 3 390

Dependents: 0

Suggesters: 0

Stars: 39

9.1.9 2021-02-14 21:16 UTC

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT ff8597f65b78f360b6ab8dde7e8fec7eb3eccefd

This package is auto-updated.

Last update: 2021-02-20 20:42:25 UTC


README

👁 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
👁 used_routes.png

Show dead routes:

bin/console show-dead-routes
👁 dead_routes.png

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.