Laravel: New "about" Command

Laravel: New "about" Command

After introducing a fresh new look for Artisan, we also took some time to identify new Artisan commands to improve your Laravel experience. We know - we're kind of obsessed.

As part of this exploration, we are introducing the about command. This command provides a gorgeous overview of your application's environment and configuration.

Artisan about command

Even better, applications and packages may also add their own custom information to the output:

use Illuminate\Foundation\Console\AboutCommand;

AboutCommand::add('My Package', 'Version', '1.0.0');

// You can also add multiple pieces of information at once...

AboutCommand::add('My Package', [
    'Version' => '1.0.0',
    'Driver' => fn() => config('package.driver'),
]);

// Or, push information to existing sections...

AboutCommand::add('Drivers', 'My Package', fn() => config('package.driver'));

Sometimes you may only want to view information from one or more sections. You can do so via the only option: php artisan about --only=drivers. Or, you can instruct the command to output the same information in JSON for easy consumption by other programs: php artisan about --json

At Laravel, we're committed to providing you with the most robust and developer-friendly PHP experience in the world. So, we hope you enjoy this new Artisan command!

Keep reading

General April 4, 2024

Encryption and the In-between

Last year, we introduced a simple but surprisingly useful feature to Laravel Forge: the ability to add notes to servers. While checking the uptake of this feature, we noticed that customers were often storing sensitive data in the field. We hadn’t designed notes to store sensitive information, so we found ourselves in a situation where we now needed to encrypt existing unencrypted data, while also allowing for new data to be inserted as encrypted data - at the same time, the dashboard needed to be able to show the notes correctly whether they had been encrypted or not. Our migration process looked like this: 1. Run a command that encrypts all existing unencrypted server notes. 2. Update our model to cast the `notes` field, encrypting or decrypting as required. To do this, we leaned on [Laravel’s custom casts](https://laravel.com/docs/11.x/eloquent-mutators#custom-casts) feature to handle this “sometimes encrypted” data. We created a new cast `SometimesEncrypted` that allowed us to gracefully decrypt the encrypted notes, or simply return the plaintext version which may have been available during the migration: ```php

James Brooks

Stay connected with the latest Laravel news