| Package Data | |
|---|---|
| Maintainer Username: | Anahkiasen |
| Maintainer Contact: | ehtnam6@gmail.com (Maxime Fabre) |
| Package Create Date: | 2014-12-03 |
| Package Last Update: | 2015-05-21 |
| Language: | PHP |
| License: | MIT |
| Last Refreshed: | 2025-11-02 03:01:31 |
| Package Statistics | |
|---|---|
| Total Downloads: | 85 |
| Monthly Downloads: | 0 |
| Daily Downloads: | 0 |
| Total Stars: | 21 |
| Total Watchers: | 2 |
| Total Forks: | 5 |
| Total Open Issues: | 0 |
Janitor is a tool to help you remove unused code, routes, views and assets from your codebase.
Simply run the following command via Composer:
$ composer require anahkiasen/janitor --dev
Then add Janitor's service provider to your application's local providers:
'Janitor\JanitorServiceProvider',
You can see the various things Janitor can do by simply running:
$ php artisan list janitor
Janitor can also be used programmatically, in order to do so:
<?php
// Define your codebase
$codebase = new Janitor\Codebase('app');
// Create an instance of any of Janitor's analyzer classes
$analyzer = new Janitor\Services\Analyzers\ViewsAnalyzer($codebase);
// Tell it which files you wish to analyze, and run the process
$analyzer->setFiles('app/views');
$files = $analyzer->analyze();
Here, $files will be a Collection of instances of AbstractAnalyzedEntity.
Its most important property is the usage property, it's an integer whose value goes from 0 (file unused) to 1 (file used). The value can vary between these two points to indicate how certain Janitor is that the file is used.
{
"root": "/Users/foobar/Sites/foo/bar/app/views",
"name": "_emails/feedback.twig",
"usage": 0
}
| Name | Description | Status | | --- | --- | --- | | ViewsAnalyzer | Analyzes your codebase and check for unused views | | | DatabaseAnalyzer | Checks your database for dead entries | Planned | | CodebaseAnalyzer | Checks your codebase for unused classes, models, etc | Planned | | RoutesAnalyzer | Checks your views and controllers for unused routes | Planned |
Contributions and suggestions are welcome.
$ phpunit
Please see CONTRIBUTING for details.
The MIT License (MIT). Please see License AbstractAnalyzedFile for more information.