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.
composer require lovegem/framework
<?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();
LoveGem puts privacy first with built-in features:
use LoveGem\Support\Facades\Crypto;
// Encrypt data
$encrypted = Crypto::encrypt('sensitive data');
// Decrypt data
$decrypted = Crypto::decrypt($encrypted);
use LoveGem\Privacy\GDPR;
// Export user data
$userData = GDPR::exportData($user);
// Delete user data
GDPR::deleteData($user);
// Anonymize user data
GDPR::anonymizeData($user);
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
]);
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();
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();
}
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
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,
]);
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
}
use LoveGem\Notifications\ChannelManager;
$channelManager = new ChannelManager($app);
// Send notification
$notification = new OrderShipped($order);
$channelManager->send($user, $notification);
use LoveGem\Api\Sanctum;
// Create API token
$token = Sanctum::createApiToken($user, [
'abilities' => ['posts:read', 'posts:write'],
]);
// Revoke token
Sanctum::revokeApiToken($user, $token);
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' => [...]]
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);
use LoveGem\Support\Fluent;
$fluent = new Fluent([
'name' => 'John',
'email' => 'john@example.com',
]);
echo $fluent->name; // John
echo $fluent->get('email'); // john@example.com
use LoveGem\Support\Str;
$string = Str::of('Hello World');
$result = $string->lower()
->append('!')
->contains('world')
->slug();
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);
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();
# 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
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
composer create-project lovegem/framework my-app
cd my-app
cp .env.example .env
php artisan key:generate
php artisan serve
# 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
# 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
We welcome contributions! Please see CONTRIBUTING.md for details.
# 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
If you discover a bug, please create an issue on GitHub.
If you discover a security vulnerability, please see SECURITY.md for details.
LoveGem Framework is open-sourced software licensed under the MIT License.
LoveGem Framework is inspired by Laravel and built with โค๏ธ by the LoveGem community.
If LoveGem Framework helped you, please give us a โญ on GitHub!
Made with โค๏ธ by the LoveGem Community