laravel-attributes / todo
A Laravel package to scan #[TODO] attributes.
1.1.0
2025-03-05 12:45 UTC
Requires
- php: ^8.0
- illuminate/console: ^9.0 || ^10.0 || ^11.0 || ^12.0
Requires (Dev)
- laravel/pint: ^1.18.1
- mockery/mockery: ^1.6
- orchestra/testbench: *
- peckphp/peck: ^0.1.1
- pestphp/pest: ^3.5.1
- pestphp/pest-plugin-type-coverage: ^3.1
- phpstan/phpstan: ^1.12.7
- rector/rector: ^1.2.8
- symfony/var-dumper: ^7.1.6
README
Laravel TODO Attribute Scanner
A small Laravel package that helps you track and manage technical debt by scanning your codebase for #[TODO]
attributes.
Features ✨
- Multi-level Scanning - Find TODOs in classes, methods, and functions
- Customizable Sources - Scan specific directories or files
- Clear Reporting - Beautiful console table output with counts
- Custom Messages - Add detailed TODO descriptions
- Laravel Integration - Native Artisan command integration
- Modern PHP With Laravel - Built for Laravel with PHP 8.1+ with attributes
Installation 📦
- Install via Composer:
composer require laravel-attributes/todo
- The package will auto-register its service provider and command.
Usage 🚀
Adding TODOs 📝
Class-level TODO
use IMohamedSheta\Todo\Attributes\TODO; use IMohamedSheta\Todo\Enums\Priority; #[TODO('Need to create extractChunks.', Priority::Medium)] class ExcelTextExtractor { // Class implementation... }
Basic Scan
Scan default directory (app):
php artisan todo
Sample Output
🔍 Scanning for TODOs... +----------+------------------------------------------------------+----------+----------------------------------+ | Type | Class/Method/Function | Priority | Message | +----------+------------------------------------------------------+----------+----------------------------------+ | Class | App\Extractors\FileTextExtractors\ExcelTextExtractor | Medium | Need to create extractChunks. | | Method | App\Actions\Auth\RegisterAction::createClinicAdmin() | High | Generate a unique billing code | | Function | app\Helpers\helpers.php -> array_only() | Medium | Not finished yet | +----------+------------------------------------------------------+----------+----------------------------------+ 🎯 Total TODOs Found: 3
Method-level TODO
use IMohamedSheta\Todo\Attributes\TODO; use IMohamedSheta\Todo\Enums\Priority; class RegisterAction { #[TODO('Generate a unique billing code for the clinic', Priority::High)] public function createClinicAdmin() { // Method implementation... } }
Function-level TODO
use IMohamedSheta\Todo\Attributes\TODO; use IMohamedSheta\Todo\Enums\Priority; #[TODO('Not finished yet', Priority::Medium)] function array_only() { // Function logic... }
Configuration ⚙️
Default Message
When no message is provided:
#[TODO] // Shows "Not finished yet" in output and priority medium as default class PendingFeature { // ... }
Custom Source Directories
Scan specific directories:
php artisan todo --src=app/Http/Controllers
License 📄
This package is open-source software licensed under the MIT license.