|
1 | | -# CodeIgniter 4 Development |
| 1 | +# CodeIgniter 4 |
2 | 2 |
|
| 3 | +[](https://packagist.org/packages/codeigniter4/framework) |
3 | 4 | [](https://github.com/codeigniter4/CodeIgniter4/actions/workflows/test-phpunit.yml) |
4 | | -[](https://github.com/codeigniter4/CodeIgniter4/actions/workflows/test-phpstan.yml) |
5 | | -[](https://github.com/codeigniter4/CodeIgniter4/actions/workflows/test-psalm.yml) |
6 | | -[](https://coveralls.io/github/codeigniter4/CodeIgniter4?branch=develop) |
7 | | -[](https://packagist.org/packages/codeigniter4/framework) |
8 | | -[](https://packagist.org/packages/codeigniter4/framework) |
9 | | -[](https://packagist.org/packages/codeigniter4/framework) |
10 | | -[](https://github.com/codeigniter4/CodeIgniter4/blob/develop/LICENSE) |
11 | | -[](https://github.com/codeigniter4/CodeIgniter4/pulls) |
12 | | -<br> |
| 5 | +[](https://github.com/codeigniter4/CodeIgniter4/actions/workflows/test-phpstan.yml) |
| 6 | +[](LICENSE) |
13 | 7 |
|
14 | | -## What is CodeIgniter? |
| 8 | +CodeIgniter 4 is a modern, lightweight PHP full-stack framework focused on developer productivity, speed, and security. It provides a collection of expressive libraries, a powerful CLI, and an intuitive MVC structure that helps you ship production-ready applications quickly. |
15 | 9 |
|
16 | | -CodeIgniter is a PHP full-stack web framework that is light, fast, flexible and secure. |
17 | | -More information can be found at the [official site](https://codeigniter.com). |
| 10 | +--- |
18 | 11 |
|
19 | | -This repository holds the source code for CodeIgniter 4 only. |
20 | | -Version 4 is a complete rewrite to bring the quality and the code into a more modern version, |
21 | | -while still keeping as many of the things intact that has made people love the framework over the years. |
| 12 | +## Overview |
22 | 13 |
|
23 | | -More information about the plans for version 4 can be found in [CodeIgniter 4](https://forum.codeigniter.com/forumdisplay.php?fid=28) on the forums. |
| 14 | +- **Lightweight core** with optional packages so you only ship what you need. |
| 15 | +- **Secure by design** thanks to CSRF protection, content security features, and built-in validation. |
| 16 | +- **Developer friendly** CLI (`php spark`) for scaffolding, migrations, tasks, and testing. |
| 17 | +- **Flexible architecture** that embraces PSR standards, Composer autoloading, and namespacing. |
24 | 18 |
|
25 | | -### Documentation |
| 19 | +## Requirements |
26 | 20 |
|
27 | | -The [User Guide](https://codeigniter.com/user_guide/) is the primary documentation for CodeIgniter 4. |
| 21 | +- PHP 8.1 or newer |
| 22 | +- `ext-intl` and `ext-mbstring` enabled |
| 23 | +- Recommended: `ext-curl`, `ext-json`, and database-specific extensions (`ext-mysqli`, `ext-pgsql`, etc.) |
28 | 24 |
|
29 | | -You will also find the [current **in-progress** User Guide](https://codeigniter4.github.io/CodeIgniter4/). |
30 | | -As with the rest of the framework, it is a work in progress, and will see changes over time to structure, explanations, etc. |
| 25 | +> PHP 8.1 reaches end of life on December 31, 2025. Upgrade sooner to stay supported. |
31 | 26 |
|
32 | | -You might also be interested in the [API documentation](https://codeigniter4.github.io/api/) for the framework components. |
| 27 | +## Quick Start |
33 | 28 |
|
34 | | -## Important Change with index.php |
| 29 | +1. **Clone and install dependencies** |
| 30 | + ```bash |
| 31 | + git clone https://github.com/codeigniter4/CodeIgniter4.git |
| 32 | + cd CodeIgniter4 |
| 33 | + composer install |
| 34 | + ``` |
| 35 | +2. **Bootstrap your environment** |
| 36 | + ```bash |
| 37 | + cp env .env |
| 38 | + php spark key:generate |
| 39 | + ``` |
| 40 | + On Windows use `copy env .env` instead of `cp`. |
| 41 | + Update `.env` with your app name, base URL, and database credentials. |
| 42 | +3. **Serve the application** |
| 43 | + ```bash |
| 44 | + php spark serve |
| 45 | + ``` |
| 46 | + Visit `http://localhost:8080` to confirm the welcome page loads. |
35 | 47 |
|
36 | | -`index.php` is no longer in the root of the project! It has been moved inside the *public* folder, |
37 | | -for better security and separation of components. |
| 48 | +## Common Tasks |
38 | 49 |
|
39 | | -This means that you should configure your web server to "point" to your project's *public* folder, and |
40 | | -not to the project root. A better practice would be to configure a virtual host to point there. A poor practice would be to point your web server to the project root and expect to enter *public/...*, as the rest of your logic and the |
41 | | -framework are exposed. |
| 50 | +- `php spark make:controller Home` – scaffold a controller. |
| 51 | +- `php spark make:migration CreateUsers` – generate a database migration. |
| 52 | +- `php spark migrate` – run pending migrations. |
| 53 | +- `php spark routes` – inspect the current routing table. |
| 54 | +- `php spark help` – list available CLI commands. |
42 | 55 |
|
43 | | -**Please** read the user guide for a better explanation of how CI4 works! |
| 56 | +Composer scripts streamline maintenance tasks: |
44 | 57 |
|
45 | | -## Repository Management |
| 58 | +- `composer test` – run the PHPUnit suite. |
| 59 | +- `composer analyze` – run static analysis (PHPStan + Rector dry run). |
| 60 | +- `composer cs` – check coding standards. |
| 61 | +- `composer cs-fix` – automatically fix coding standards. |
| 62 | +- `composer metrics` – generate PhpMetrics reports. |
46 | 63 |
|
47 | | -CodeIgniter is developed completely on a volunteer basis. As such, please give up to 7 days |
48 | | -for your issues to be reviewed. If you haven't heard from one of the team in that time period, |
49 | | -feel free to leave a comment on the issue so that it gets brought back to our attention. |
| 64 | +## Project Structure |
50 | 65 |
|
51 | | -> [!IMPORTANT] |
52 | | -> We use GitHub issues to track **BUGS** and to track approved **DEVELOPMENT** work packages. |
53 | | -> We use our [forum](http://forum.codeigniter.com) to provide SUPPORT and to discuss |
54 | | -> FEATURE REQUESTS. |
| 66 | +- `app/` – application code (controllers, models, views, configuration). |
| 67 | +- `public/` – web server document root containing `index.php`. |
| 68 | +- `system/` – framework core (avoid editing directly). |
| 69 | +- `tests/` – PHPUnit test suite. |
| 70 | +- `writable/` – runtime storage (cache, logs, sessions, uploads). |
55 | 71 |
|
56 | | -If you raise an issue here that pertains to support or a feature request, it will |
57 | | -be closed! If you are not sure if you have found a bug, raise a thread on the forum first - |
58 | | -someone else may have encountered the same thing. |
| 72 | +Configure your web server (Apache/Nginx) to serve the `public/` directory to keep application files outside the public web root. |
59 | 73 |
|
60 | | -Before raising a new GitHub issue, please check that your bug hasn't already |
61 | | -been reported or fixed. |
| 74 | +## Documentation & Guides |
62 | 75 |
|
63 | | -We use pull requests (PRs) for CONTRIBUTIONS to the repository. |
64 | | -We are looking for contributions that address one of the reported bugs or |
65 | | -approved work packages. |
66 | | - |
67 | | -Do not use a PR as a form of feature request. |
68 | | -Unsolicited contributions will only be considered if they fit nicely |
69 | | -into the framework roadmap. |
70 | | -Remember that some components that were part of CodeIgniter 3 are being moved |
71 | | -to optional packages, with their own repository. |
| 76 | +- Official User Guide: https://codeigniter.com/user_guide/ |
| 77 | +- In-progress Docs (latest develop): https://codeigniter4.github.io/CodeIgniter4/ |
| 78 | +- API Reference: https://codeigniter4.github.io/api/ |
| 79 | +- Community Forum: https://forum.codeigniter.com/ |
| 80 | +- Slack Community: https://codeigniterchat.slack.com/ |
72 | 81 |
|
73 | 82 | ## Contributing |
74 | 83 |
|
75 | | -We **are** accepting contributions from the community! It doesn't matter whether you can code, write documentation, or help find bugs, |
76 | | -all contributions are welcome. |
77 | | - |
78 | | -Please read the [*Contributing to CodeIgniter*](https://github.com/codeigniter4/CodeIgniter4/blob/develop/contributing/README.md). |
79 | | - |
80 | | -CodeIgniter has had thousands on contributions from people since its creation. This project would not be what it is without them. |
81 | | - |
82 | | -<a href="https://github.com/codeigniter4/CodeIgniter4/graphs/contributors"> |
83 | | - <img src="https://contrib.rocks/image?repo=codeigniter4/CodeIgniter4" /> |
84 | | -</a> |
85 | | - |
86 | | -Made with [contrib.rocks](https://contrib.rocks). |
87 | | - |
88 | | -## Server Requirements |
89 | | - |
90 | | -PHP version 8.1 or higher is required, with the following extensions installed: |
| 84 | +We welcome bug reports, documentation updates, and pull requests from the community. Before contributing: |
91 | 85 |
|
92 | | -- [intl](http://php.net/manual/en/intl.requirements.php) |
93 | | -- [mbstring](http://php.net/manual/en/mbstring.installation.php) |
| 86 | +1. Review the [contributing guide](contributing/README.md). |
| 87 | +2. Search existing issues to avoid duplicates. |
| 88 | +3. Use GitHub Issues for confirmed bugs and approved enhancements; use the forum for support or feature ideas. |
94 | 89 |
|
95 | | -> [!WARNING] |
96 | | -> - The end of life date for PHP 7.4 was November 28, 2022. |
97 | | -> - The end of life date for PHP 8.0 was November 26, 2023. |
98 | | -> - If you are still using PHP 7.4 or 8.0, you should upgrade immediately. |
99 | | -> - The end of life date for PHP 8.1 will be December 31, 2025. |
| 90 | +PRs should include tests when applicable and follow the project's coding standards (`composer cs` / `composer cs-fix`). |
100 | 91 |
|
101 | | -Additionally, make sure that the following extensions are enabled in your PHP: |
| 92 | +## Security |
102 | 93 |
|
103 | | -- json (enabled by default - don't turn it off) |
104 | | -- [mysqlnd](http://php.net/manual/en/mysqlnd.install.php) if you plan to use MySQL |
105 | | -- [libcurl](http://php.net/manual/en/curl.requirements.php) if you plan to use the HTTP\CURLRequest library |
| 94 | +Report security issues via the [responsible disclosure process](SECURITY.md). Please do not open public GitHub issues for vulnerabilities. |
106 | 95 |
|
107 | | -## Running CodeIgniter Tests |
| 96 | +## License |
108 | 97 |
|
109 | | -Information on running the CodeIgniter test suite can be found in the [README.md](tests/README.md) file in the tests directory. |
| 98 | +CodeIgniter 4 is open-source software released under the [MIT License](LICENSE). |
0 commit comments