Getting Started - Installation
This guide will walk you through the installation process of the Ecommerce framework, including setting up the database schema and seeding initial data.
Installation Methods
We provide a streamlined CLI interface for installing and managing the application.
Install via Composer
Install the framework package into your WordPress installation using Composer.
Description:
The composer require command adds the ollyo/droip-ecommerce package to your project's dependencies and installs it. This setup ensures that all necessary framework files, including the core Application class, service providers, and helper utilities, are available. It automatically registers the plugin loader if configured in your composer.json.
Method Signature:
composer require ollyo/droip-ecommerce --dev
Parameters:
package- The package nameollyo/droip-ecommerce.--dev- (Optional) Installs the package as a development dependency.
Examples:
# Standard installation
composer require ollyo/droip-ecommerce
# Development installation
composer require ollyo/droip-ecommerce --dev
Run Database Migrations
Create the necessary database tables for the application.
Description:
The migrate command executes all pending database migrations. It scans the database/migrations directory for migration classes and runs their up() methods. This creates the database schema required for models like Product, Order, and Customer to function. It uses the Schema Builder to generate platform-specific SQL (MySQL/MariaDB).
Method Signature:
wp droip migrate [--force]
Parameters:
--force- (Optional) Force the migration operation to run when in production.
Examples:
# Run all pending migrations
wp droip migrate
# Force migrations in production environment
wp droip migrate --force
SQL Output:
-- Example SQL generated by creating the products table
CREATE TABLE `droip_ecommerce_products` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`type` varchar(255) NOT NULL DEFAULT 'simple',
`name` varchar(255) NOT NULL,
`slug` varchar(255) NOT NULL,
`sku` varchar(255) DEFAULT NULL,
`price` decimal(10,2) NOT NULL DEFAULT '0.00',
`status` varchar(50) NOT NULL DEFAULT 'draft',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `droip_ecommerce_products_slug_unique` (`slug`),
UNIQUE KEY `droip_ecommerce_products_sku_unique` (`sku`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Example SQL for orders table
CREATE TABLE `droip_ecommerce_orders` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`customer_id` bigint(20) unsigned DEFAULT NULL,
`status` varchar(50) NOT NULL DEFAULT 'pending',
`total` decimal(10,2) NOT NULL DEFAULT '0.00',
`currency` varchar(3) NOT NULL DEFAULT 'USD',
`created_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
Seed Database
Populate the database with initial or dummy data for testing.
Description:
The db:seed command populates the database with data using Seeder classes. It is useful for setting up a development environment with realistic data. You can run all seeders or specify a specific class. Seeders typically use the Query Builder or Model factories to insert records into tables like products and customers.
Method Signature:
wp droip db:seed [--class=ClassName] [--force]
Parameters:
--class- (Optional) The specific seeder class to run (e.g.,ProductSeeder). Defaults to runningDatabaseSeeder.--force- (Optional) Force the seed operation to run when in production.
Examples:
# Run the main DatabaseSeeder
wp droip db:seed
# Run a specific seeder class
wp droip db:seed --class=ProductSeeder
# Run CustomerSeeder with force flag
wp droip db:seed --class=CustomerSeeder --force
SQL Output:
-- Example SQL generated by ProductSeeder
INSERT INTO `droip_ecommerce_products` (
`type`, `name`, `slug`, `sku`, `price`, `status`, `created_at`, `updated_at`
) VALUES (
'simple', 'T-Shirt', 't-shirt', 'TSH-001', 19.99, 'publish', '2026-01-23 12:00:00', '2026-01-23 12:00:00'
);
-- Example SQL generated by CustomerSeeder
INSERT INTO `droip_ecommerce_customers` (
`first_name`, `last_name`, `email`, `created_at`, `updated_at`
) VALUES (
'John', 'Doe', 'john@example.com', '2026-01-23 12:00:00', '2026-01-23 12:00:00'
);