pipo/raft 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

pipo/raft

最新稳定版本:v1.0.2

Composer 安装命令:

composer require pipo/raft

包简介

A Docker-based development environment for CodeIgniter 4

README 文档

README

CodeIgniter Raft is a lightweight, Docker-powered development environment for CodeIgniter 4 that simplifies local development workflows. Built with PHP-FPM and Apache2, it provides a ready-to-use containerized setup with zero configuration required.

CodeIgniter Raft

Introduction

CodeIgniter Raft provides a Docker-powered local development experience for CodeIgniter 4 that is compatible with macOS, Windows (WSL2), and Linux. Other than Docker, no software or libraries are required to be installed on your local computer before using Raft. Raft's simple CLI means you can start building your CodeIgniter application without any previous Docker experience.

Installation

You can install CodeIgniter Raft as a development dependency in your CodeIgniter project:

composer require pipo/raft

After installing CodeIgniter Raft, run the following command to set up the Raft configuration files in your project:

./raft install

This command will copy the necessary Docker configuration files to your project's root directory.

Basic Usage

Starting & Stopping Raft

To start all of the Docker containers defined in your application's docker-compose.yml file:

./raft up

To stop all of the Docker containers:

./raft down

Executing Commands

You can execute commands inside the application container using the raft script:

PHP Commands

./raft php -v

Composer Commands

./raft composer require codeigniter4/devkit

CodeIgniter CLI Commands

./raft spark migrate
./raft spark db:seed UserSeeder

Running Tests

./raft test

Accessing MySQL

./raft mysql

Opening a Shell

./raft shell

Configuring A Shell Alias

By default, Raft commands are invoked using the raft script that is included with your project:

./raft up

However, instead of repeatedly typing ./raft to execute Raft commands, you may wish to configure a shell alias that allows you to execute Raft's commands more easily:

alias raft='sh $([ -f raft ] && echo raft || echo vendor/bin/raft)'

To make sure this is always available, you may add this to your shell configuration file in your home directory, such as ~/.zshrc or ~/.bashrc, and then restart your shell.

Once the shell alias has been configured, you may execute Raft commands by simply typing raft. The remainder of this documentation's examples will assume that you have configured this alias:

raft up

Available Services

By default, Raft includes the following services:

  • raft-app: The CodeIgniter application with PHP 8.2 and Apache
  • mysql: MySQL 8.0 database
  • redis: Redis server
  • mailhog: MailHog for testing emails

Customization

Environment Variables

The following environment variables can be added to your project's .env file to customize your Raft installation:

APP_PORT=80
DB_PORT=3306
REDIS_PORT=6379
MAILHOG_PORT=1025
MAILHOG_DASHBOARD_PORT=8025

Adding Custom Services

You can add additional services to your application by creating a docker-compose.override.yml file in your project's root directory.

Requirements

  • Docker
  • Docker Compose
  • PHP 7.4 or higher
  • Composer

License

CodeIgniter Raft is open-sourced software licensed under the MIT license.

统计信息

  • 总下载量: 26
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: Shell

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-04-25