Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Tlint Laravel Package

tightenco/tlint

Tighten’s opinionated linter for Laravel and PHP projects. Enforces consistent conventions and catches style issues using preset and custom rules, runnable via CLI or CI. Built on PHP_CodeSniffer with sensible Laravel-focused defaults.

View on GitHub
Deep Wiki
Context7

Tighten linter for Laravel conventions.

Frequently asked questions about Tlint
How do I install and run tlint in a Laravel project?
Install via Composer with `composer require tightenco/tlint`, then run `./vendor/bin/tlint` in your project root. Use `--preset=laravel` for Laravel-specific rules. For auto-fixing, add `--fix` to the command. Ensure PHP 8.1+ is used, as older versions are unsupported.
Which Laravel versions does tlint support?
tlint is optimized for Laravel 8.0+ and works with Laravel 11/13 conventions. It enforces modern patterns like FullyQualifiedFacades and UseAnonymousMigrations. For legacy Laravel (pre-8.0), some rules may not apply, and custom presets may be needed.
Can I customize tlint’s rules or exclude specific files?
Yes, create a `tlint.json` config file to define custom presets, exclude paths (e.g., `tests/`), or override rule severity. Example: `"exclude": ["app/Helpers/*.php"], "rules": {"NoDump": "error"}`. This allows granular control over linting behavior.
How does tlint handle Blade template linting?
tlint checks Blade files for spacing around directives (e.g., `@if`), but custom directives (like `@inject`) may cause false positives. Test edge cases with `--profile` to identify issues. For complex templates, exclude problematic files or adjust rule severity in `tlint.json`.
Is tlint compatible with PHPStan or PHP-CS-Fixer?
Yes, tlint complements static analyzers like PHPStan (logic-focused) and overlaps with PHP-CS-Fixer (e.g., Blade spacing). Use tlint for Laravel-specific rules and PHP-CS-Fixer for generic PHP formatting. Run them sequentially in CI for comprehensive checks.
How should I integrate tlint into GitHub Actions?
Add a step to your workflow like this: `- name: Run TLint run: ./vendor/bin/tlint --preset=laravel --fail-on=warning`. Use `--fix` for auto-corrections or `--format=checkstyle` to generate XML reports for CI integration. Gate linting as a required check to enforce consistency.
What are the performance implications of running tlint?
tlint uses AST parsing, which can be CPU-intensive for large codebases. Run `./vendor/bin/tlint --profile` to identify bottlenecks, especially in files with nested facades or complex route logic. For CI, consider caching dependencies or splitting linting into smaller batches.
How do I handle existing code violations when adopting tlint?
Start with `--ignore` flags for critical violations (e.g., `--ignore=NoDump`) and gradually enforce rules. Use a phased rollout: first run in dry mode (`--format=checkstyle`), then enable warnings, and finally errors. Document exceptions in `tlint.json` for team alignment.
Are there alternatives to tlint for Laravel linting?
Alternatives include PHP-CS-Fixer (generic PHP) and Laravel-specific tools like laravel-shift/laravel-lint. However, tlint is uniquely opinionated for Laravel conventions (e.g., facades, migrations) and integrates seamlessly with its ecosystem. For non-Laravel projects, consider generic PHP linters like Psalm.
Can tlint detect dynamic method calls or magic methods like __call?
Yes, tlint detects dynamic method calls, including `__call()` or magic methods, and flags them as violations. This was fixed in v9.6.1, but legacy code may still trigger issues. Use `--ignore=DynamicMethodCalls` temporarily if needed, or refactor incrementally with `--fix`.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
calmfox/watch-sylius
damienfern/grpc-symfony-bundle
atoolo/index-bundle
atoolo/genai-bundle
coprotoai/laravel-ticket
davidjln/llm-carbon-bundle
cryonighter/valid-request-bundle
coolms/taxonomy-bundle
coolms/field-bundle
articulate-orm/symfony
aaix/laravel-tall-architect
ephoto/akeneo-connector
emmanuelballery/eb-plantumlbundle
emielburgman/symfony-visitor-beacon
emielburgman/symfony-visit-storage
emielburgman/symfony-security-headers
emielburgman/symfony-log-viewer
emarref/xdebug-bundle
emarref/pubnub-bundle
elriseio/finance-money-bundle