Laravel naming convention for blade files
Stefan Bogdanescu
Founder & Senior Architect · 2026-06-29
# Laravel Naming Conventions for Blade Files: Finding the Right Balance
Naming conventions are the bedrock of maintainable code, and while Laravel provides excellent guidance for Eloquent models, controllers, and services, the naming convention for Blade view files often remains a point of debate among developers. You've hit on a common challenge: how do we translate the structure of our application (like controller methods) into clean, navigable file paths?
This post will dive into the various approaches suggested for naming Blade files in Laravel and establish a pragmatic best practice from a senior developer’s perspective.
## The Context: MVC and File Structure
Laravel follows the Model-View-Controller (MVC) pattern. Controllers handle logic, models handle data, and views handle presentation. By extension, the file system structure should logically mirror this separation. When naming views, we are essentially defining the structure of our presentation layer.
The debate often boils down to whether to use dot notation (`types.blade.php`), snake\_case (`property_types.blade.php`), or kebab-case (`property-types.blade.php`). There is no single, mandatory PSR rule dictating the exact filename for a Blade view; rather, it falls into the realm of established project convention.
## Analyzing the Approaches
Let’s evaluate the options you presented in the context of readability and tooling:
### 1. Dot Notation (`types.blade.php`)
This approach is clean and concise. It often works well when the view directly corresponds to a single resource or entity (e.g., `user.profile.blade.php`). However, for complex actions derived from controller methods, it can become ambiguous if you have many nested views.
### 2. Snake Case (`property_types.blade.php`)
Snake case is very common in PHP code and database contexts. It is highly readable among developers familiar with backend conventions. The downside here is that mixing snake\_case for file paths can sometimes feel inconsistent with the general front-end or framework naming styles, although it is perfectly valid within a Laravel project structure.
### 3. Kebab Case (`property-types.blade.php`)
Kebab case (using hyphens) is strongly favored in CSS, HTML attributes, and generally for file paths because it clearly separates words without relying on underscores or dots which can sometimes be misinterpreted by certain tooling or legacy systems. It offers maximum visual separation.
## The Best Practice: Consistency Over Strict Rules
As a senior developer, my recommendation is to prioritize **consistency within your team and project** over adhering to a single, rigid external PSR rule for view files. Since the structure of your application dictates the naming, you should choose the style that feels most natural and remains consistent throughout your codebase.
For complex views derived from controller actions, I lean towards **kebab-case (`property-types.blade.php`)** or a well-defined **snake\_case** if your team is heavily invested in PHP conventions.
**Why Kebab Case Often Wins for Views:**
When dealing with file systems and URLs (even implicitly in routing), kebab-case avoids potential conflicts that underscores or dots might introduce when dealing with environment variables or complex pathing. Furthermore, it aligns well with how many front-end tooling interacts with these paths.
Consider the example where you are managing property types:
```php
// Controller method: AdminController@listPropertyTypes
// Recommended view file name: resources/views/admin/property-types.blade.php
```
This structure clearly maps to the resource (`admin`), the entity (`property`), and the action/view type (`types`). When you start building larger applications, maintaining this predictable pattern is far more valuable than choosing one arbitrary style over another. As noted in Laravel documentation regarding architecture, ensuring your scaffolding and file organization remains logical is crucial for long-term maintainability.
## Conclusion
There is no single "official" PSR rule governing Blade file naming; it is a convention you establish. The key takeaway is: **Choose a consistent pattern and stick to it.** Whether you choose `property_types.blade.php` or `property-types.blade.php`, ensure every view in your application follows the exact same convention. This small act of discipline prevents cognitive load for future developers, making your Laravel application cleaner, easier to navigate, and more robust as it scales.