Module 1: Modern Setup (Bedrock)

Moving away from FTP and spaghetti code.

Why Bedrock?

Standard WordPress installations mix core files with your custom code. Bedrock separates them, manages plugins via Composer, and uses `.env` files for configuration.

Key Concepts

1. The Bedrock Structure

Unlike standard WP, Bedrock looks like a modern PHP app:

├── config/          # WP configuration
├── web/
│   ├── app/         # wp-content (themes, plugins)
│   └── wp/          # WP Core (Git ignored)
├── .env             # Secrets
└── composer.json    # Dependencies

2. Installing Bedrock

Start a new project:

composer create-project roots/bedrock my-project

3. Environment Variables

Configure your `.env` file for local development:

DB_NAME='my_db'
DB_USER='db_user'
DB_PASSWORD='db_password'
WP_HOME='http://my-project.test'
WP_SITEURL="${WP_HOME}/wp"

4. Managing Plugins with Composer

Install plugins from WordPress Packagist:

composer require wpackagist-plugin/wordpress-seo
composer require wpackagist-plugin/timber-library

5. Database: PostgreSQL via PG4WP

We are moving away from MySQL. Install the PG4WP driver:

  1. Download `pg4wp` and place it in `web/app/db.php`.
  2. Update `.env` to point to your PostgreSQL instance.

6. Redis Object Cache

Configure Redis for high-performance object caching:

composer require wpackagist-plugin/redis-cache

Add to `config/application.php`:

Config::define('WP_REDIS_HOST', env('REDIS_HOST'));

7. NocoDB Integration Setup

We will use NocoDB as an external data source. Install the HTTP client:

composer require guzzlehttp/guzzle

8. Custom Directory Structure

Understand where your code goes:

9. Security Hardening

Bedrock secures your site by default:

10. Deployment Workflow

With Bedrock, you deploy the entire application artifact, not just theme files. This ensures consistency across environments.