Database
Using the app:install
Artisan command you can install the database
component:
php <your-app-name> app:install database
As you might have already guessed, it is Laravel's Eloquent component that works like a breeze in the Laravel Zero environment too.
Usage:
use Illuminate\Support\Facades\DB;
DB::table('users')->insert(
['email' => 'enunomaduro@gmail.com']
);
$users = DB::table('users')->get();
Laravel Database Migrations, database factories, and Database Seeding features are also included.
Redis
Laravel Zero also provides a component for Redis, an in-memory data-structure store.
To get started with using Redis for fast data storage or caching, install the Component with:
php <your-app-name> app:install redis
You can then use the Redis facade after configuring Redis in your config/database.php
.
use Illuminate\Support\Facades\Redis;
Redis::set('full_name', 'Daniel LaRusso');
Redis::get('full_name');
Check the Laravel documentation for full details of using Redis.
Note on PHAR builds
The database
directory isn't included in Laravel Zero standalone PHAR builds by default.
If you are using the Database components migration, factory, or seeder functionality make sure to add the directory to your Box configurations directories
section.