Skip to content

jam-afaq/Laravel-Enterprise-Starter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 Laravel Enterprise Starter

A production-ready Laravel application with Repository Pattern, Service Layer, and modern architecture

FeaturesQuick StartDocumentationTech StackContributing

Laravel PHP Tailwind License


📖 About This Project

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.

✨ What Makes This Special?

  • 🏗️ 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

🎯 Features

Core Features

  • 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

UI Features

  • 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

🚀 Quick Start

Prerequisites

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

Installation Steps

1️⃣ Clone the Repository

git clone https://github.com/YOUR_USERNAME/laravel-enterprise-starter.git
cd laravel-enterprise-starter

2️⃣ Install PHP Dependencies

composer install

3️⃣ Install JavaScript Dependencies

npm install
# or
yarn install

4️⃣ Environment Setup

# Copy the example environment file
cp .env.example .env

# Generate application key
php artisan key:generate

5️⃣ Configure Database

Open .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

6️⃣ Run Migrations

# Run all migrations
php artisan migrate

# (Optional) Seed the database with sample data
php artisan db:seed

7️⃣ Build Assets

# Development
npm run dev

# Production
npm run build

8️⃣ Start Development Server

php artisan serve

Visit http://localhost:8000 in your browser. 🎉


📚 Documentation

Project Structure

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

Key Concepts

Repository Pattern

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
}

Service Layer

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;
    }
}

Form Requests

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'],
        ];
    }
}

Available Routes

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

🛠️ Tech Stack

Backend

  • Laravel 11.x - PHP Framework
  • PHP 8.2+ - Programming Language
  • MySQL/PostgreSQL - Database
  • Spatie Activity Log - Activity tracking

Frontend

  • TailwindCSS 3.x - Utility-first CSS framework
  • Alpine.js - Lightweight JavaScript framework
  • Blade Templates - Laravel templating engine
  • Vite - Frontend build tool

Development Tools

  • Composer - PHP dependency manager
  • NPM/Yarn - JavaScript package manager
  • Laravel Pint - Code style fixer
  • PHPUnit - Testing framework

🧪 Testing

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 --coverage

📦 Packages Used

PHP Packages

  • spatie/laravel-activitylog - Activity logging
  • laravel/pail - Log viewer
  • laravel/tinker - REPL for Laravel

JavaScript Packages

  • tailwindcss - CSS framework
  • autoprefixer - CSS vendor prefixing
  • postcss - CSS transformations

🎨 Customization

Adding New Features

  1. Create Repository Interface

    # Create in app/Repositories/Interfaces/
  2. Implement Repository

    # Create in app/Repositories/Eloquent/
  3. Create Service

    # Create in app/Services/
  4. Create Controller

    php artisan make:controller YourController
  5. Create Form Requests

    php artisan make:request StoreYourRequest
    php artisan make:request UpdateYourRequest

Styling

Customize TailwindCSS in tailwind.config.js:

export default {
    theme: {
        extend: {
            colors: {
                primary: '#6366f1',
                secondary: '#8b5cf6',
            }
        }
    }
}

🤝 Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Code Style

This project follows PSR-12 coding standards. Run Laravel Pint before committing:

./vendor/bin/pint

📝 License

This project is open-sourced software licensed under the MIT license.


🙏 Acknowledgments

  • Laravel - The PHP Framework
  • Spatie - Activity Log Package
  • TailwindCSS - CSS Framework
  • All contributors who help improve this project

📧 Contact & Support


Made with ❤️ by developers, for developers

⭐ Star this repo if you find it helpful!

About

No description, website, or topics provided.

Resources

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages