Skip to content

Latest commit

 

History

History
170 lines (133 loc) · 6.89 KB

File metadata and controls

170 lines (133 loc) · 6.89 KB

Frameworks

DBox supports frameworks across three runtimes: PHP, Go, and Rust. Each framework is a plugin in src/dbox/plugins/ describing how to detect it, what it needs, how to scaffold it, and which native CLI it exposes.

Supported

PHP

Name (dbox create <name>) Label Document root Native CLI
laravel Laravel /public dbox artisan
symfony Symfony /public dbox console
codeigniter CodeIgniter 4 /public dbox spark
codeigniter3 CodeIgniter 3 /
cakephp CakePHP /webroot dbox cake
yii Yii /web dbox yii
corephp Core PHP /
wordpress WordPress / dbox wp
drupal Drupal /web dbox drush
magento Magento /pub dbox magento
joomla Joomla / dbox joomla

Go

Name Label App port Native CLI
gin Gin 8080 dbox go
echo Echo 8080 dbox go
go Plain Go (net/http) 8080 dbox go

Detection scans go.mod for github.com/gin-gonic/gin / github.com/labstack/echo/v4.

Rust

Name Label App port Native CLI
actix Actix-web 8080 dbox cargo
axum Axum 8080 dbox cargo
rust Plain Rust 8080 dbox cargo

Detection scans Cargo.toml's [dependencies] for actix-web / axum. See runtimes.md for how Go/Rust projects differ from PHP at the container/networking level.

Default services per framework

dbox create/init enable a sensible set of companion services per framework (toggle any afterwards — see services.md):

Framework Mailpit phpMyAdmin Elasticsearch Redis
Laravel
Symfony
CodeIgniter 3 & 4
WordPress
Core PHP
Magento
CakePHP, Yii, Drupal, Joomla

Redis is off by default everywhere — enable per project with dbox redis enable. Every framework also gets a MariaDB database (unless you switch to SQLite), with credentials matching the project name plus a root / root admin login (see databases.md).

Automatic database connection

For Laravel, Symfony, CakePHP, and CodeIgniter 4, DBox wires the app to the database automatically (via injected environment variables) — a freshly created project connects with no manual config, and waits for the DB to be ready before starting. See databases.md.

Notes on specific frameworks

  • WordPress — needs the mysqli extension (not just PDO); DBox enables it automatically. DB config is entered in WordPress's install wizard (host db). WordPress installs WP-CLI into the image (dbox wp …).
  • CodeIgniter 3 — CI 3.1.x isn't clean on PHP 8.2+ (it emits "dynamic property deprecated" notices), so DBox defaults CI3 projects to PHP 8.1. Switch any project's PHP with dbox php use <version>.

How detection works

dbox init / dbox detect run every plugin's detection rules and pick the highest-priority match. A plugin matches if any of these is true:

  • a required set of files all exist, or
  • any of a set of marker files exists, or
  • composer.json requires one of the plugin's packages.

When several match (e.g. CodeIgniter 4 markers also satisfy CodeIgniter 3), the higher priority wins.

Framework Detection markers composer.json require
Laravel artisan (+ bootstrap/app.php or routes/web.php) laravel/framework
Symfony bin/console (+ config/bundles.php or src/Kernel.php) symfony/framework-bundle, symfony/flex
CodeIgniter 4 spark (+ app/Config/App.php) codeigniter4/framework
CodeIgniter 3 application/config/config.php + system/core/CodeIgniter.php
CakePHP bin/cake cakephp/cakephp
Yii yii yiisoft/yii2
WordPress wp-config.php, wp-load.php, or wp-content/
Drupal core/lib/Drupal.php or sites/default/settings.php drupal/core
Magento bin/magento magento/product-community-edition
Joomla configuration.php or libraries/src/Factory.php
Core PHP index.php (lowest priority fallback)

PHP version is additionally inferred from the php constraint in composer.json; extensions from framework defaults plus any ext-* requires.

Scaffolding (dbox create)

Most frameworks scaffold via composer create-project run inside the PHP container, so the result lands in your project on the host:

Framework Scaffolding source
Laravel composer create-project laravel/laravel
Symfony composer create-project symfony/skeleton + composer require webapp
CodeIgniter 4 composer create-project codeigniter4/appstarter
CakePHP composer create-project cakephp/app
Yii composer create-project yiisoft/yii2-app-basic
Drupal composer create-project drupal/recommended-project + Drush
WordPress wp core download (WP-CLI is baked into the image)
CodeIgniter 3 downloads the official release tarball
Joomla downloads the official release tarball
Core PHP writes a starter index.php
Magento composer create-project … magento/project-community-edition (see below)

Magento

Magento's Composer repository (repo.magento.com) requires authenticated access keys, generated at Adobe Commerce Marketplace → My Profile → Access Keys. The public key is the username, the private key the password.

dbox create magento shop will:

  1. Prompt for the keys — or read MAGENTO_PUBLIC_KEY / MAGENTO_PRIVATE_KEY from the environment (useful in CI):

    export MAGENTO_PUBLIC_KEY=xxxxxxxx
    export MAGENTO_PRIVATE_KEY=yyyyyyyy
    dbox create magento shop
  2. Inject them as a COMPOSER_AUTH environment variable into the scaffolding container (no auth.json is written to disk).

  3. Run composer create-project … magento/project-community-edition.

  4. Print the setup:install command to finish the install once the database and Elasticsearch containers are up:

    # db-name is your project name; root / root always works as the DB login
    dbox magento setup:install \
      --base-url=http://localhost --db-host=db --db-name=<project> \
      --db-user=root --db-password=root \
      --search-engine=elasticsearch7 --elasticsearch-host=elasticsearch \
      --admin-firstname=Admin --admin-lastname=User \
      --admin-email=admin@example.com --admin-user=admin --admin-password=Admin123!

Magento enables Elasticsearch and phpMyAdmin by default and installs the full extension set it requires (bcmath, gd, intl, mbstring, soap, sockets, sodium, xml, xsl, zip, pdo_mysql, opcache).

Adding your own framework

See plugins.md.