|
| 1 | +# CodeIgniter 4 Template Project |
| 2 | + |
| 3 | +This is a template project for CodeIgniter 4, a powerful PHP framework for building web applications. It comes pre-configured with Docker, Nginx, MySQL, Adminer, phplint, Psalm, and PHP_CodeSniffer to streamline your development process. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +- Dockerized development environment |
| 8 | +- Nginx web server configuration |
| 9 | +- Custom PHP configuration (php.ini) |
| 10 | +- MySQL database server |
| 11 | +- Adminer database management tool |
| 12 | +- Automated code linting and analysis with phplint, Psalm, and PHP_CodeSniffer |
| 13 | + |
| 14 | +## Requirements |
| 15 | + |
| 16 | +Before getting started, ensure that you have the following software installed on your system: |
| 17 | + |
| 18 | +- Docker |
| 19 | +- Docker Compose |
| 20 | + |
| 21 | +## Getting Started |
| 22 | + |
| 23 | +To set up and run the project on your local machine, follow these steps: |
| 24 | + |
| 25 | +### 1. Clone the Repository |
| 26 | + |
| 27 | +```bash |
| 28 | +git clone https://github.com/YuriiDorosh/CodeIgniter4-template.git |
| 29 | +cd CodeIgniter4-template |
| 30 | +``` |
| 31 | + |
| 32 | +### 2. Environment Configuration |
| 33 | + |
| 34 | +Copy the example environment file and configure it as needed: |
| 35 | + |
| 36 | +``` |
| 37 | +cp .env.example .env |
| 38 | +``` |
| 39 | + |
| 40 | +### 3. Start Docker Containers |
| 41 | + |
| 42 | +Run Docker Compose to start the development environment: |
| 43 | + |
| 44 | +``` |
| 45 | +docker-compose up -d |
| 46 | +``` |
| 47 | + |
| 48 | +This command will create and start the Docker containers defined in the docker-compose.yml file. |
| 49 | + |
| 50 | +### 4. Install Composer Dependencies |
| 51 | + |
| 52 | +``` |
| 53 | +docker-compose exec php composer install |
| 54 | +``` |
| 55 | + |
| 56 | +### 5. Access the Application |
| 57 | + |
| 58 | +Once the Docker containers are running, you can access the application in your web browser: |
| 59 | + |
| 60 | +- CodeIgniter Application: http://localhost:8080 |
| 61 | +- Adminer (Database Management Tool): http://localhost:8081 |
| 62 | + |
| 63 | +### 6. Development Workflow |
| 64 | + |
| 65 | +Running phplint |
| 66 | + |
| 67 | +``` |
| 68 | +docker-compose exec php make phplint |
| 69 | +``` |
| 70 | + |
| 71 | +Running Psalm |
| 72 | + |
| 73 | +``` |
| 74 | +docker-compose exec php make psalm |
| 75 | +``` |
| 76 | + |
| 77 | +Running PHP_CodeSniffer |
| 78 | + |
| 79 | +``` |
| 80 | +docker-compose exec php make phpcs |
| 81 | +``` |
| 82 | + |
| 83 | +### 7. Stopping the Containers |
| 84 | + |
| 85 | +When you're done working on the project, you can stop the Docker containers: |
| 86 | + |
| 87 | +``` |
| 88 | +docker-compose down |
| 89 | +``` |
0 commit comments