Project Initialization

Prerequisites: Design Analysis

Objective

Install Blackcube CMS in a Yii2 project and verify the installation works correctly. This step creates the base database structure and configures back-office access.

Package Installation

Blackcube consists of two Composer packages:

blackcube/core: The CMS core (required) blackcube/admin: The admin interface (recommended)

In your Yii2 project, install the packages:

    composer require blackcube/core
composer require blackcube/admin
    

Module Configuration

Core Module

Add the Blackcube module in your webapp configuration:

    'modules' => [
    'blackcube' => [
        'class' => blackcube\core\Module::class,
        'slugSensitive' => false,
    ],
]
    

  1. false: /général and /general are identical (recommended)
  2. true: /général and /general are different
slugSensitive: Defines if URLs are accent-sensitive

Admin Module

Add the admin module in your webapp configuration:

    'modules' => [
    'bo' => [
        'class' => blackcube\admin\Module::class,
        'adminTemplatesAlias' => '@app/admin',
        'additionalAssets' => [],
        'modules' => [],
    ],
]
    

adminTemplatesAlias: Path to custom admin templates additionalAssets: Additional CSS/JS assets for backoffice modules: Admin sub-modules (for plugins)

Structure Creation

Run migrations to create Blackcube tables:

    # Database migration
php yii.php migrate

# RBAC rights initialization
php yii.php bc:init

# Initial administrator creation
php yii.php bc:admin/create
    

Info

These commands create all necessary tables (nodes, composites, blocs, slugs, etc.) and initialize Blackcube. Only needed at startup.

Web Server Configuration

Apache

.htaccess file in public folder:

    RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
    

Nginx

Minimal configuration:

    location / {
    try_files $uri $uri/ /index.php?$args;
}
    

Installation Verification

Backoffice Access

Access the admin interface:

    http://your-site.local/bo
    

Log in with credentials created during bc:admin/create.

Creation Test

  1. Management → Sections
  2. Management → Articles
  3. Settings → Block Types
  4. Settings → Types
In the backoffice, verify you can access:

If all these sections are accessible, the installation is correct.

Initial Configuration

Enable Languages

In the backoffice:

  1. Go to Settings → Languages
  2. Enable French (fr)
  3. Enable English (en)
  4. Set French as default language

Quick activation via SQL:

    UPDATE languages SET active = 1 WHERE id IN ('fr', 'en');
UPDATE languages SET active = 0 WHERE id NOT IN ('fr', 'en');
    

Create Admin Folder

Create the folder for custom admin templates:

    mkdir -p common/admin
    

This folder will contain admin templates for BlocTypes (Hero, CTA, Card).

Project Structure

After installation, your project should have this minimal structure:

    my-project/
├── common/
│   ├── config/
│   └── admin/              # Admin templates (to create)
├── webapp/
│   ├── config/
│   ├── controllers/
│   ├── models/
│   ├── views/
│   └── web/
│       └── index.php
└── composer.json
    

Troubleshooting

Migration Error

Problem: The migrate command fails

  1. Check database configuration
  2. Ensure database exists and user has necessary rights
  3. Verify PHP has MySQL/PDO extension enabled
Solutions:

404 Error on /bo

Problem: The /bo page returns a 404 error

  1. Verify the bo module is properly configured
  2. Check web server configuration
  3. Clear cache: php yii.php cache/flush-all
Solutions:

bc:init Command Not Found

Problem: The bc:init command returns "Unknown command"

  1. Verify blackcube/core is properly installed via Composer
  2. Verify the blackcube module is configured
  3. Run composer dump-autoload
Solutions:

Validation

  1. Blackcube installed via Composer
  2. Modules configured in webapp config
  3. Migrations executed
  4. Back-office access working
  5. FR/EN languages enabled
  6. common/admin folder created
Before continuing: