A production-ready Laravel application with Repository Pattern, Service Layer, and modern architecture
Features • Quick Start • Documentation • Tech Stack • Contributing
Laravel Enterprise Starter is a modern, enterprise-grade Laravel application template that implements industry best practices and design patterns. Perfect for developers who want to build scalable, maintainable applications with a solid foundation.
- 🏗️ Clean Architecture - Repository Pattern with Service Layer separation
- 📊 Activity Logging - Track all user actions with Spatie Activity Log
- 🔐 Authorization - Laravel Policies for fine-grained access control
- 📝 Form Requests - Dedicated validation classes for clean controllers
- 🎨 Modern UI - Beautiful TailwindCSS interface with smooth animations
- 🎯 DTOs - Data Transfer Objects for type-safe data handling
- 🔔 Events & Listeners - Event-driven architecture
- 🧩 Enums - Type-safe enumerations
- 🛠️ Helper Functions - Reusable utility functions
- 📱 Responsive Design - Mobile-first approach
- ✅ User Management - Complete CRUD operations with validation
- ✅ Activity Logs - System-wide activity tracking and filtering
- ✅ Form Validation - Custom Form Request classes
- ✅ Repository Pattern - Abstraction layer for data access
- ✅ Service Layer - Business logic separation
- ✅ Event System - Decoupled event handling
- ✅ Policy Authorization - Role-based access control ready
- ✅ Animated Quotes - Inspirational programming quotes on homepage
- ✅ Modern Dashboard - Clean, professional interface
- ✅ Responsive Tables - Mobile-friendly data tables
- ✅ Toast Notifications - Success/error messages
- ✅ Loading States - Better user experience
- ✅ Hover Effects - Smooth animations and transitions
Before you begin, ensure you have the following installed:
- PHP >= 8.2
- Composer >= 2.0
- Node.js >= 18.x
- NPM or Yarn
- MySQL >= 8.0 or PostgreSQL >= 13
- Git
git clone https://github.com/YOUR_USERNAME/laravel-enterprise-starter.git
cd laravel-enterprise-startercomposer installnpm install
# or
yarn install# Copy the example environment file
cp .env.example .env
# Generate application key
php artisan key:generateOpen .env file and update database credentials:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=your_database_name
DB_USERNAME=your_database_user
DB_PASSWORD=your_database_password# Run all migrations
php artisan migrate
# (Optional) Seed the database with sample data
php artisan db:seed# Development
npm run dev
# Production
npm run buildphp artisan serveVisit http://localhost:8000 in your browser. 🎉
laravel-enterprise-starter/
├── app/
│ ├── DTOs/ # Data Transfer Objects
│ ├── Enums/ # Enumerations
│ ├── Events/ # Event classes
│ ├── Helpers/ # Helper functions
│ ├── Http/
│ │ ├── Controllers/ # Controllers
│ │ ├── Middleware/ # Middleware
│ │ └── Requests/ # Form Requests
│ ├── Listeners/ # Event listeners
│ ├── Models/ # Eloquent models
│ ├── Policies/ # Authorization policies
│ ├── Repositories/ # Repository classes
│ │ ├── Interfaces/ # Repository interfaces
│ │ └── Eloquent/ # Eloquent implementations
│ ├── Services/ # Service layer
│ └── Traits/ # Reusable traits
├── database/
│ ├── factories/ # Model factories
│ ├── migrations/ # Database migrations
│ └── seeders/ # Database seeders
├── resources/
│ ├── css/ # Stylesheets
│ ├── js/ # JavaScript files
│ └── views/ # Blade templates
├── routes/
│ ├── web.php # Web routes
│ └── api.php # API routes
└── tests/ # Tests
Repositories provide an abstraction layer between your application and data access logic.
// Interface
interface UserRepositoryInterface {
public function all(): Collection;
public function find(int $id): ?User;
public function create(array $data): User;
}
// Implementation
class EloquentUserRepository implements UserRepositoryInterface {
// Implementation details
}Services contain business logic and orchestrate operations.
class UserService {
public function createUser(array $data): User {
// Hash password
$data['password'] = Hash::make($data['password']);
// Create user
$user = $this->userRepository->create($data);
// Dispatch event
event(new UserCreated($user));
return $user;
}
}Dedicated classes for validation logic.
class StoreUserRequest extends FormRequest {
public function rules(): array {
return [
'name' => ['required', 'string', 'max:255'],
'email' => ['required', 'email', 'unique:users'],
'password' => ['required', 'min:8', 'confirmed'],
];
}
}| Method | URI | Description |
|---|---|---|
| GET | / |
Homepage with animated quotes |
| GET | /users |
List all users |
| GET | /users/create |
Show create user form |
| POST | /users |
Store new user |
| GET | /users/{id} |
Show user details |
| GET | /users/{id}/edit |
Show edit user form |
| PUT/PATCH | /users/{id} |
Update user |
| DELETE | /users/{id} |
Delete user |
| GET | /activity-logs |
View system activity logs |
- Laravel 11.x - PHP Framework
- PHP 8.2+ - Programming Language
- MySQL/PostgreSQL - Database
- Spatie Activity Log - Activity tracking
- TailwindCSS 3.x - Utility-first CSS framework
- Alpine.js - Lightweight JavaScript framework
- Blade Templates - Laravel templating engine
- Vite - Frontend build tool
- Composer - PHP dependency manager
- NPM/Yarn - JavaScript package manager
- Laravel Pint - Code style fixer
- PHPUnit - Testing framework
Run the test suite:
# Run all tests
php artisan test
# Run specific test file
php artisan test --filter=UserTest
# Run with coverage
php artisan test --coveragespatie/laravel-activitylog- Activity logginglaravel/pail- Log viewerlaravel/tinker- REPL for Laravel
tailwindcss- CSS frameworkautoprefixer- CSS vendor prefixingpostcss- CSS transformations
-
Create Repository Interface
# Create in app/Repositories/Interfaces/ -
Implement Repository
# Create in app/Repositories/Eloquent/ -
Create Service
# Create in app/Services/ -
Create Controller
php artisan make:controller YourController
-
Create Form Requests
php artisan make:request StoreYourRequest php artisan make:request UpdateYourRequest
Customize TailwindCSS in tailwind.config.js:
export default {
theme: {
extend: {
colors: {
primary: '#6366f1',
secondary: '#8b5cf6',
}
}
}
}Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project follows PSR-12 coding standards. Run Laravel Pint before committing:
./vendor/bin/pintThis project is open-sourced software licensed under the MIT license.
- Laravel - The PHP Framework
- Spatie - Activity Log Package
- TailwindCSS - CSS Framework
- All contributors who help improve this project
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Made with ❤️ by developers, for developers
⭐ Star this repo if you find it helpful!