Optional Packages

Last updated: 04/17/2026 · Written by Agent0

Optional Packages

StackCTL keeps its core dependency-free. Optional packages are managed through config/packages.php and installed on demand via Composer. You only pull in what your project actually needs.


Installing Packages

There are two ways to install optional packages:

Interactive installer

php stack packages:install

Lists all uninstalled packages and lets you select which ones to install by number. Type all to install everything at once.

Check what's installed

php stack packages:status

Shows every available package and whether it's currently installed.

Install directly via Composer

composer require phpmailer/phpmailer

Standard Composer installs work fine too — the CLI installer is just a convenience wrapper.


Available Packages

Email — phpmailer/phpmailer

Sends email via SMTP. Required for email verification, password reset, MFA codes, and any other outgoing mail in your app. Configured via config/mail.php.

composer require phpmailer/phpmailer

Once installed, use MailService to send email from any controller:

use Services\MailService;

MailService::send(
    'recipient@example.com',
    'Welcome to My App',
    '<p>Thanks for signing up!</p>'
);

The from_email and from_name are set automatically from config/mail.php. The body accepts HTML. See the Configuration doc for SMTP setup.

MFA / Two-Factor Auth — robthree/twofactorauth

Adds TOTP support for authenticator apps (Google Authenticator, Authy, etc.). Required when mfa_driver is set to 'app' or 'both' in config/auth.php.

composer require robthree/twofactorauth

Enable it in config/auth.php:

'mfa_enabled' => true,
'mfa_driver'  => 'app', // or 'both' for email + app

Test Data — fakerphp/faker

Generates realistic fake data for seeding your database during development and testing.

composer require fakerphp/faker
$faker = Faker\Factory::create();

Query::table('articles')->insert([
    'title'      => $faker->sentence(),
    'content'    => $faker->paragraphs(3, true),
    'slug'       => generate_slug($faker->sentence(), 'articles'),
    'created_by' => 1,
]);

Payments — stripe/stripe-php

The official Stripe PHP SDK for payment processing — subscriptions, one-time payments, customer management, and more.

composer require stripe/stripe-php
\Stripe\Stripe::setApiKey(config('billing.stripe_secret'));

$intent = \Stripe\PaymentIntent::create([
    'amount'   => 2999, // in cents
    'currency' => 'usd',
]);

Store your Stripe keys in a custom config/billing.php file and load it in bootstrap/init.php. See the Configuration doc for how to add custom config files.

SMS & Communication — twilio/sdk

The official Twilio SDK for sending SMS messages, making calls, and other communication workflows.

composer require twilio/sdk
$twilio = new Twilio\Rest\Client($accountSid, $authToken);

$twilio->messages->create('+15551234567', [
    'from' => '+15559876543',
    'body' => 'Your verification code is 482910',
]);

PDF Generation — dompdf/dompdf

Converts HTML to PDF. Useful for invoices, reports, exports, and any document that needs to be downloaded as a PDF.

composer require dompdf/dompdf
use Dompdf\Dompdf;

$dompdf = new Dompdf();
$dompdf->loadHtml('<h1>Invoice #1234</h1><p>Amount due: $99.00</p>');
$dompdf->setPaper('A4', 'portrait');
$dompdf->render();
$dompdf->stream('invoice-1234.pdf');

HTTP Client — guzzlehttp/guzzle

A full-featured HTTP client for making requests to external APIs and services.

composer require guzzlehttp/guzzle
$client   = new GuzzleHttp\Client();
$response = $client->get('https://api.example.com/users', [
    'headers' => ['Authorization' => 'Bearer ' . $token]
]);

$data = json_decode($response->getBody(), true);

UUID Generation — ramsey/uuid

Generates UUIDs (Universally Unique Identifiers) — useful as public-facing IDs when you don't want to expose sequential integer IDs in URLs.

composer require ramsey/uuid
use Ramsey\Uuid\Uuid;

$uuid = Uuid::uuid4()->toString();
// → 'f47ac10b-58cc-4372-a567-0e02b2c3d479'

Query::table('articles')->insert([
    'uuid'  => Uuid::uuid4()->toString(),
    'title' => 'My Article',
]);

Environment Variables — vlucas/phpdotenv

Loads environment variables from a .env file into $_ENV and getenv(). Useful for keeping sensitive credentials out of your config files and version control.

composer require vlucas/phpdotenv

Add this to the top of bootstrap/init.php:

$dotenv = Dotenv\Dotenv::createImmutable(__DIR__ . '/..');
$dotenv->load();

Then reference values in config files:

'password' => $_ENV['DB_PASSWORD']

Add .env to your .gitignore so credentials are never committed.

Logging — monolog/monolog

A comprehensive logging library supporting multiple log channels — files, databases, Slack, email, and more.

composer require monolog/monolog
use Monolog\Logger;
use Monolog\Handler\StreamHandler;

$log = new Logger('app');
$log->pushHandler(new StreamHandler('storage/logs/app.log', Logger::DEBUG));

$log->info('User logged in', ['user_id' => auth('id')]);
$log->error('Payment failed', ['order_id' => $orderId]);

Media Processing — php-ffmpeg/php-ffmpeg

PHP wrapper for FFmpeg — for transcoding video, extracting audio, generating thumbnails, and other media processing tasks. Requires FFmpeg to be installed on the server.

composer require php-ffmpeg/php-ffmpeg

Verify FFmpeg is available on your system before using this package:

ffmpeg -version
Was this helpful?