muhammadadela/phplitecore

phpLiteCore is a modern, lightweight, and fast PHP framework for building web applications of any size.

Maintainers

Package info

github.com/MuhammadAdelA/phpLiteCore

pkg:composer/muhammadadela/phplitecore

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 6

v1.0.0 2025-11-18 19:55 UTC

README

PHP Version License Tests Documentation

phpLiteCore is a modern, lightweight, and fast PHP framework designed for building web applications of any size. It focuses on simplicity, speed, and a clean architecture, providing core essentials without unnecessary bloat.

โœจ Features

  • โšก Ultra-lightweight and Fast: Minimal core for optimal performance.
  • ๐Ÿงฉ Clean Architecture: Adheres to MVC principles with strict separation of concerns.
  • ๐Ÿงฑ Hybrid Active Record: Simplifies database interactions (Querying & Manipulation).
  • ๐Ÿ›ฃ๏ธ Flexible Routing: Supports GET, POST, dynamic route parameters, named routes, and reverse URL generation.
  • ๐ŸŒ Built-in Translation (i18n): Modular system supporting multiple languages (EN/AR included).
  • ๐Ÿ›ก๏ธ Environment-Aware Error Handling: Detailed errors in development, user-friendly messages & developer notifications (SMTP) in production.
  • ๐Ÿ“ฆ Asset Management Ready: Integrated with NPM, Webpack, and SCSS for easy frontend workflows.
  • โœ”๏ธ Input Validation: Simple, integrated validation system.
  • ๐Ÿ“„ Pagination: Built-in pagination logic and renderers (Bootstrap 5).
  • ๐Ÿ› ๏ธ Extensible: Designed to be easily extended with custom components.

๐Ÿš€ Getting Started

Quick Start with Docker (Recommended for Development)

The easiest way to get started is using Docker Compose on WSL2 Ubuntu 24.04:

# Clone the repository
git clone https://github.com/MuhammadAdelA/phpLiteCore.git
cd phpLiteCore

# Run the automated setup script (one-time setup)
chmod +x setup-wsl2-ubuntu.sh
./setup-wsl2-ubuntu.sh

# Start the development environment
docker-compose up -d

# Install dependencies and build assets
docker-compose exec app composer install
docker-compose exec app npm install
docker-compose exec app npm run build

# Access your application at http://localhost:8080

See the complete Docker Setup Guide for detailed instructions, troubleshooting, and advanced usage.

Manual Setup (Traditional)

  1. Clone the repository:

    git clone https://github.com/MuhammadAdelA/phpLiteCore.git
    cd phpLiteCore
  2. Install Dependencies:

    # Install PHP dependencies
    composer install
    
    # Install Node.js dependencies and build assets
    npm install
    npm run build # or 'npm run dev' for development
  3. Configure Environment:

    • Copy .env.example to .env.
    • Update .env with your database credentials, SMTP settings (for production error reporting), and APP_ENV (development or production).
  4. Set Up Database:

    • Import the phplitecore.sql file into your MySQL database.
  5. Configure Web Server:

    • Recommended (Secure): Point your web server's document root to the public/ directory. This ensures only the public assets are accessible.
    • Alternative (Backward Compatible): Point to the project root directory. The .htaccess file will redirect requests to public/, but this is less secure.
    • Ensure mod_rewrite (or equivalent for your server) is enabled.
  6. Run:

    • Open the project URL in your browser. You should see the welcome page!

๐Ÿ“– Documentation

View the live documentation:

https://muhammadadela.github.io/phpLiteCore/

(Includes guides for both English and Arabic, covering core concepts, routing, database interaction, translation, and more.)

Database Layer Quick Start

phpLiteCore provides a powerful yet simple database layer with Active Record pattern:

// Find a user by ID
$user = User::find(1);

// Query with conditions
$activeAdmins = User::where('role', 'admin')
    ->where('status', 'active')
    ->orderBy('created_at', 'DESC')
    ->get();

// Eager load relationships to avoid N+1 queries
$users = User::with(['posts', 'profile'])
    ->where('status', 'active')
    ->get();

// Use transactions for data integrity
$db->beginTransaction();
try {
    $user->credits -= 100;
    $user->save();
    
    $otherUser->credits += 100;
    $otherUser->save();
    
    $db->commit();
} catch (\Exception $e) {
    $db->rollBack();
}

Comprehensive Guides:

Development Environment:

For a complete Docker-based development environment on WSL2 Ubuntu 24.04, see the Docker Setup Guide with instructions for:

  • Automated setup script for WSL2
  • Docker Compose configuration
  • Development tools (phpMyAdmin, MailHog)
  • Troubleshooting and common tasks

Network Configuration:

If you need to configure network access for GitHub Actions or work behind firewalls, see the Network Configuration Guide for detailed setup instructions.

๐Ÿ“ฆ Versioning

phpLiteCore follows Semantic Versioning 2.0.0 (SemVer). We maintain a detailed CHANGELOG.md documenting all notable changes for each release.

Version Support

  • Active Support: 12 months (bug fixes, security patches, new features)
  • Security Support: Additional 12 months (security patches only)
  • Total Support: 24 months per major version

Current Version

Check the latest release for the current stable version.

Learn More:

๐Ÿ›ก๏ธ Security

Security is a top priority for phpLiteCore. If you discover a security vulnerability, please review our Security Policy for responsible disclosure guidelines.

๐Ÿงช Code Quality

phpLiteCore maintains high code quality standards:

  • PSR-12 Compliant: All code follows PSR-12 coding standards
  • Static Analysis: Uses PHPStan for type safety
  • Automated Tests: Comprehensive test suite with Pest PHP
  • Code Style: Automated formatting with PHP CS Fixer

Running Quality Checks

# Run tests
./vendor/bin/pest

# Run static analysis (requires PHPStan)
composer require --dev phpstan/phpstan
./vendor/bin/phpstan analyse

# Fix code style (requires PHP CS Fixer)
composer require --dev friendsofphp/php-cs-fixer
./vendor/bin/php-cs-fixer fix

๐Ÿค Contributing

Contributions are welcome! Please read the CONTRIBUTING.md guide and our Code of Conduct.

๐Ÿ“œ License

phpLiteCore is open-source software licensed under the MIT license.