lovegem / framework
LoveGem - Laravel se better! Privacy-first PHP framework with advanced features
Package info
github.com/gamingwithashis07-sys/Codeble-Environment-
Type:framework
pkg:composer/lovegem/framework
Requires
- php: >=8.1
- ext-bcmath: *
- ext-dom: *
- ext-fileinfo: *
- ext-json: *
- ext-mbstring: *
- ext-openssl: *
- ext-pdo: *
- ext-sodium: *
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- phpstan/phpstan: ^1.0
- phpunit/phpunit: ^10.0
README
Laravel se better! Privacy-first PHP framework with advanced features.
LoveGem is a modern, privacy-first PHP framework inspired by Laravel. It provides everything you need to build amazing web applications, plus additional features that make it even better than Laravel.
๐ Documentation
๐ Quick Start
Installation
composer require lovegem/framework
Basic Usage
<?php declare(strict_types=1); use LoveGem\Core\Application; use LoveGem\Container\Container; // Create application $app = new Application(__DIR__); // Register service providers $app->register(LoveGem\Http\ServiceProvider::class); $app->register(LoveGem\View\ServiceProvider::class); $app->register(LoveGem\Database\ServiceProvider::class); // Use the framework $app->router->get('/hello', function () { return 'Hello from LoveGem!'; }); $app->run();
โจ Features
Core Framework
- Service Container - IoC container with dependency injection
- Service Providers - Modular service registration
- Facades - Static proxy classes
- Pipeline - Middleware pipeline
- Config Repository - Configuration management
- Helpers - Array and String utilities
HTTP Layer
- Router - RESTful routing with middleware
- Request/Response - HTTP abstraction
- Middleware - 13+ built-in middleware
- CSRF Protection - Automatic CSRF tokens
- HTTP Client - cURL wrapper with retries
Database
- Eloquent ORM - Beautiful ActiveRecord implementation
- Relations - HasOne, HasMany, BelongsTo, BelongsToMany
- Migrations - Database version control
- Seeders - Database seeding
- Query Builder - Fluent query builder
Authentication
- Guard System - Multiple authentication guards
- Session Guard - Cookie-based authentication
- Password Hashing - bcrypt/Argon2 support
- API Tokens - Sanctum-like token management
Views
- Blade Templating - Powerful template engine
- Layouts & Sections - Template inheritance
- Components - Reusable UI components
- Custom Directives - Extend Blade syntax
Validation
- Validator - 30+ validation rules
- Error Messages - Customizable messages
- Custom Rules - Extend validation system
Session
- Store - Session management
- Flash Data - One-time messages
- CSRF Token - Cross-site request forgery protection
Cache
- Repository - Multiple cache drivers
- Remember - Cache with callback
- Tags - Cache tagging
Queue
- Job Queue - Background processing
- Delay - Scheduled jobs
- Connections - Multiple queue connections
- Mailer - Email sending
- SMTP Transport - SMTP configuration
- HTML/Text Templates - Multi-format emails
Events
- Dispatcher - Event system
- Listeners - Event handlers
- Wildcards - Wildcard listeners
Logging
- Logger - PSR-3 logging
- Multiple Channels - File, daily, stack
- Log Levels - All levels supported
Console
- Artisan CLI - Command-line interface
- 20+ Commands - Built-in commands
- Custom Commands - Create your own
Exception Handling
- Handler - Centralized exception handling
- HTTP Exceptions - Exception codes
- Error Pages - Custom error pages
๐ Privacy Features (LoveGem Special)
LoveGem puts privacy first with built-in features:
Encryption Service
use LoveGem\Support\Facades\Crypto; // Encrypt data $encrypted = Crypto::encrypt('sensitive data'); // Decrypt data $decrypted = Crypto::decrypt($encrypted);
GDPR Compliance
use LoveGem\Privacy\GDPR; // Export user data $userData = GDPR::exportData($user); // Delete user data GDPR::deleteData($user); // Anonymize user data GDPR::anonymizeData($user);
Data Minimization
use LoveGem\Privacy\DataMinimization; // Only collect necessary data DataMinimization::collect($data, [ 'name' => true, // Required 'email' => true, // Required 'phone' => false, // Optional - don't collect 'address' => false, // Optional - don't collect ]);
๐ Advanced Features (Better than Laravel!)
Task Scheduler
use LoveGem\Scheduler\Schedule; $schedule = new Schedule(); // Run every 15 minutes $schedule->call(function () { // Cleanup tasks })->everyFifteenMinutes(); // Run daily at 9 AM $schedule->command('emails:send')->dailyAt('09:00'); // Run weekly $schedule->job(new BackupJob)->weekly();
HTTP Client
use LoveGem\Http\Client; $client = new Client(); // GET request $response = $client->get('https://api.example.com/users'); // POST with JSON $response = $client->timeout(10) ->withHeaders(['Authorization' => 'Bearer token']) ->post('https://api.example.com/users', [ 'name' => 'John', 'email' => 'john@example.com', ]); // Handle response if ($response->successful()) { $data = $response->json(); }
Rate Limiter
use LoveGem\RateLimiting\RateLimiter; $rateLimiter = new RateLimiter($cache); // Limit requests $rateLimiter->attempt('api', 60, function () { return response()->json(['message' => 'Success']); }, 60); // 60 attempts per minute
Broadcasting (WebSocket)
use LoveGem\Broadcasting\Broadcaster; $broadcaster = new Broadcaster(); // Define channel $broadcaster->channel('chat', function ($user) { return true; }); // Broadcast event $broadcaster->broadcast(['chat'], 'new.message', [ 'user' => $user->name, 'message' => $message, ]);
File Storage
use LoveGem\Filesystem\Filesystem; $filesystem = new Filesystem(); // Store file $filesystem->put('file.txt', 'content', 'local'); // Get file $content = $filesystem->get('file.txt'); // Delete file $filesystem->delete('file.txt'); // Check if exists if ($filesystem->exists('file.txt')) { // File exists }
Notifications
use LoveGem\Notifications\ChannelManager; $channelManager = new ChannelManager($app); // Send notification $notification = new OrderShipped($order); $channelManager->send($user, $notification);
API Tokens (Sanctum)
use LoveGem\Api\Sanctum; // Create API token $token = Sanctum::createApiToken($user, [ 'abilities' => ['posts:read', 'posts:write'], ]); // Revoke token Sanctum::revokeApiToken($user, $token);
Health Checks
use LoveGem\Health\HealthChecker; $health = new HealthChecker(); // Register checks $health->check('database', function () { return $database->ping(); }); $health->check('cache', function () { return $cache->ping(); }); // Get report $report = $health->report(); // ['status' => 'ok', 'checks' => [...]]
Lazy Collections
use LoveGem\Support\LazyCollection\LazyCollection; // Memory efficient collection $users = LazyCollection::from($database->cursor()); $users->filter(fn ($user) => $user->active) ->map(fn ($user) => $user->name) ->each(fn ($name) => echo $name . PHP_EOL);
Fluent Arrays
use LoveGem\Support\Fluent; $fluent = new Fluent([ 'name' => 'John', 'email' => 'john@example.com', ]); echo $fluent->name; // John echo $fluent->get('email'); // john@example.com
Stringable Objects
use LoveGem\Support\Str; $string = Str::of('Hello World'); $result = $string->lower() ->append('!') ->contains('world') ->slug();
Webhooks
use LoveGem\Webhooks\WebhookManager; $webhooks = new WebhookManager(); // Register webhook $webhooks->register('order.created', 'https://api.example.com/webhook'); // Dispatch webhook $webhooks->dispatch('order.created', $order);
Profiler (Telescope)
use LoveGem\Profiler\Profiler; $profiler = Profiler::getInstance(); // Start profiling $profiler->start('query'); // Execute query $results = $database->select('SELECT * FROM users'); // Stop profiling $profiler->stop('query'); // Get report $report = $profiler->report();
๐จ Artisan Commands
# Development php artisan serve php artisan tinker # Database php artisan migrate php artisan migrate:rollback php artisan migrate:refresh php artisan db:seed # Generate php artisan make:model User php artisan make:controller UserController php artisan make:migration create_users_table php artisan make:seeder UserSeeder php artisan make:test UserTest php artisan make:policy UserPolicy php artisan make:middleware AuthMiddleware php artisan make:command SendEmailsCommand # Cache php artisan cache:clear php artisan config:clear php artisan route:clear php artisan view:clear # Security php artisan key:generate # Scheduler php artisan schedule:run php artisan schedule:list # Queue php artisan queue:work php artisan queue:listen php artisan queue:failed php artisan queue:retry # Health php artisan health:check php artisan health:report
๐ Directory Structure
lovegem-framework/
โโโ app/
โ โโโ Console/
โ โ โโโ Commands/
โ โโโ Exceptions/
โ โโโ Http/
โ โ โโโ Controllers/
โ โ โโโ Middleware/
โ โ โโโ Requests/
โ โโโ Models/
โ โโโ Providers/
โโโ bootstrap/
โ โโโ helpers.php
โโโ config/
โ โโโ app.php
โ โโโ auth.php
โ โโโ cache.php
โ โโโ database.php
โ โโโ filesystems.php
โ โโโ logging.php
โ โโโ mail.php
โ โโโ queue.php
โ โโโ services.php
โ โโโ sessions.php
โโโ database/
โ โโโ factories/
โ โโโ migrations/
โ โโโ seeders/
โโโ public/
โ โโโ index.php
โโโ resources/
โ โโโ css/
โ โโโ js/
โ โโโ views/
โโโ routes/
โ โโโ api.php
โ โโโ channels.php
โ โโโ console.php
โ โโโ web.php
โโโ src/
โ โโโ Api/
โ โโโ Auth/
โ โโโ Broadcasting/
โ โโโ Cache/
โ โโโ Config/
โ โโโ Console/
โ โโโ Container/
โ โโโ Core/
โ โโโ Database/
โ โโโ Events/
โ โโโ Exceptions/
โ โโโ Facades/
โ โโโ Filesystem/
โ โโโ Hashing/
โ โโโ Health/
โ โโโ Http/
โ โโโ Logging/
โ โโโ Mail/
โ โโโ Notifications/
โ โโโ Profiler/
โ โโโ Queue/
โ โโโ RateLimiting/
โ โโโ Scheduler/
โ โโโ Session/
โ โโโ Support/
โ โโโ Validation/
โ โโโ View/
โ โโโ Webhooks/
โโโ storage/
โ โโโ app/
โ โโโ cache/
โ โโโ framework/
โ โโโ logs/
โ โโโ sessions/
โโโ tests/
โ โโโ Feature/
โ โโโ Unit/
โโโ .env
โโโ .env.example
โโโ .gitignore
โโโ composer.json
โโโ phpunit.xml.dist
โโโ phpstan.neon
โโโ .php-cs-fixer.dist.php
โโโ CHANGELOG.md
โโโ CODE_OF_CONDUCT.md
โโโ CONTRIBUTING.md
โโโ LICENSE
โโโ README.md
โโโ SECURITY.md
๐ฆ Installation
Requirements
- PHP 8.1 or higher
- Extensions: mbstring, json, openssl, sodium, dom, fileinfo, bcmath
Install via Composer
composer create-project lovegem/framework my-app
cd my-app
cp .env.example .env
php artisan key:generate
php artisan serve
Manual Installation
# Clone repository git clone https://github.com/lovegem-framework/lovegem.git cd lovegem # Install dependencies composer install # Copy environment file cp .env.example .env # Generate application key php artisan key:generate # Run migrations php artisan migrate # Start development server php artisan serve
๐งช Testing
# Run all tests composer test # Run unit tests php vendor/bin/phpunit tests/Unit # Run feature tests php vendor/bin/phpunit tests/Feature # Run with coverage php vendor/bin/phpunit --coverage-html coverage # Run static analysis composer phpstan # Check code style composer cs-check # Fix code style composer cs-fix
๐ Documentation
๐ค Contributing
We welcome contributions! Please see CONTRIBUTING.md for details.
Development Setup
# Clone the repository git clone https://github.com/lovegem-framework/lovegem.git # Install dependencies composer install # Run tests composer test # Check code style composer cs-check
๐ Bug Reports
If you discover a bug, please create an issue on GitHub.
๐ Security
If you discover a security vulnerability, please see SECURITY.md for details.
๐ License
LoveGem Framework is open-sourced software licensed under the MIT License.
๐ Credits
LoveGem Framework is inspired by Laravel and built with โค๏ธ by the LoveGem community.
Special Thanks
- Taylor Otwell - Creator of Laravel
- The PHP Community
- All Contributors
๐ Support
If LoveGem Framework helped you, please give us a โญ on GitHub!
๐ง Contact
- Documentation: https://gamingwithashis07-sys.github.io/Codeble-Environment-/
- GitHub: https://github.com/gamingwithashis07-sys/Codeble-Environment-
Made with โค๏ธ by the LoveGem Community