Skip to content

Commit c724e44

Browse files
committed
Merge branch 'develop' into php-7.2
2 parents 53508f3 + 05175e6 commit c724e44

60 files changed

Lines changed: 1275 additions & 479 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ php:
88
matrix:
99
fast_finish: true
1010
allow_failures:
11-
- php: 7.3
1211
- php: nightly
1312

1413
global:

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<br>
66

77
## What is CodeIgniter?
8+
89
CodeIgniter is a PHP full-stack web framework that is light, fast, flexible, and secure.
910
More information can be found at the [official site](http://codeigniter.com).
1011

@@ -35,6 +36,7 @@ framework are exposed.
3536
The user guide updating and deployment is a bit awkward at the moment, but we are working on it!
3637

3738
## Repository Management
39+
3840
We use Github issues to track **BUGS** and to track approved **DEVELOPMENT** work packages.
3941
We use our [forum](http://forum.codeigniter.com) to provide SUPPORT and to discuss
4042
FEATURE REQUESTS.
@@ -57,6 +59,7 @@ Remember that some components that were part of CodeIgniter 3 are being moved
5759
to optional packages, with their own repository.
5860

5961
## Contributing
62+
6063
We **are** accepting contributions from the community, specifically those identified as part of phase 2.
6164

6265
We will try to manage the process somewhat, by adding a "Help wanted" label to those that we are
@@ -68,8 +71,10 @@ We are not looking for out-of-scope contributions, only those that would be cons
6871
Please read the [*Contributing to CodeIgniter*](https://github.com/codeigniter4/CodeIgniter4/blob/develop/contributing.md) section in the user guide
6972

7073
## Server Requirements
74+
7175
PHP version 7.2 or higher is required, with the following extensions installed:
7276

77+
7378
- [intl](http://php.net/manual/en/intl.requirements.php)
7479
- [libcurl](http://php.net/manual/en/curl.requirements.php) if you plan to use the HTTP\CURLRequest library
7580

@@ -81,4 +86,5 @@ Additionally, make sure that the following extensions are enabled in your PHP:
8186
- xml (enabled by default - don't turn it off)
8287

8388
## Running CodeIgniter Tests
89+
8490
Information on running CodeIgniter test suite can be found in the [README.md](tests/README.md) file in the tests directory.

admin/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
#CodeIgniter 4 Admin
1+
# CodeIgniter 4 Admin
22

33
This folder contains tools or docs useful for project maintainers.
44

5-
##Repositories inside https://github.com/codeigniter4
5+
## Repositories inside https://github.com/codeigniter4
66

77
- **CodeIgniter4** is the main development repository.
88
It supports issues and pull requests, and has a rule to enforce GPG-signed commits.
@@ -35,23 +35,23 @@ This folder contains tools or docs useful for project maintainers.
3535
It is community-maintained, and accepts issues and pull requests.
3636
It could be downloaded, forked or composer-installed.
3737

38-
##Contributor Scripts
38+
## Contributor Scripts
3939

4040
- **setup.sh** installs a git pre-commit hook into a contributor's
4141
local clone of their fork of the `CodeIgniter4` repository.
4242
- **pre-commit** runs PHP Lint and PHP CodeSniffer on any files
4343
to be added as part of a git commit, ensuring that they conform to the
4444
framework coding style standards, and automatically fixing what can be.
4545

46-
##Maintainer Scripts
46+
## Maintainer Scripts
4747

4848
- **release-config** holds variables used for the maintainer & release building
4949
- **docbot** re-builds the user guide from the RST source for it,
5050
and optionally deploys it to the `gh-pages` branch of the main
5151
repository (if the user running it has maintainer rights on that repo).
5252
See the [writeup](./docbot.md).
5353

54-
##Release Building Scripts
54+
## Release Building Scripts
5555

5656
The release workflow is detailed in its own writeup; these are the main
5757
scripts used by the release manager:
@@ -79,7 +79,7 @@ scripts used by the release manager:
7979
Remember to be polite when running it.
8080

8181

82-
##Other Stuff
82+
## Other Stuff
8383

8484
- **release-notes.bb** is a boilerplate for forum announcements of a new release.
8585
It is marked up using [BBcode](https://en.wikipedia.org/wiki/BBCode).

admin/framework/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# CodeIgniter 4 Framework
22

33
## What is CodeIgniter?
4+
45
CodeIgniter is a PHP full-stack web framework that is light, fast, flexible, and secure.
56
More information can be found at the [official site](http://codeigniter.com).
67

@@ -29,6 +30,7 @@ framework are exposed.
2930
The user guide updating and deployment is a bit awkward at the moment, but we are working on it!
3031

3132
## Repository Management
33+
3234
We use Github issues to track **BUGS** and to track approved **DEVELOPMENT** work packages.
3335
We use our [forum](http://forum.codeigniter.com) to provide SUPPORT and to discuss
3436
FEATURE REQUESTS.
@@ -51,11 +53,13 @@ Remember that some components that were part of CodeIgniter 3 are being moved
5153
to optional packages, with their own repository.
5254

5355
## Contributing
56+
5457
We welcome contributions from the community.
5558

5659
Please read the [*Contributing to CodeIgniter*](https://github.com/codeigniter4/CodeIgniter4/blob/develop/contributing.md) section in the development repository.
5760

5861
## Server Requirements
62+
5963
PHP version 7.2 or higher is required, with the following extensions installed:
6064

6165
- [intl](http://php.net/manual/en/intl.requirements.php)

admin/userguide/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# CodeIgniter 4 User Guide
22

33
## What is CodeIgniter?
4+
45
CodeIgniter is a PHP full-stack web framework that is light, fast, flexible, and secure.
56
More information can be found at the [official site](http://codeigniter.com).
67

app/Config/Modules.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,16 @@ class Modules
1414
*/
1515
public $enabled = true;
1616

17+
/*
18+
|--------------------------------------------------------------------------
19+
| Auto-Discovery Within Composer Packages Enabled?
20+
|--------------------------------------------------------------------------
21+
|
22+
| If true, then auto-discovery will happen across all namespaces loaded
23+
| by Composer, as well as the namespaces configured locally.
24+
*/
25+
public $discoverInComposer = true;
26+
1727
/*
1828
|--------------------------------------------------------------------------
1929
| Auto-discover Rules

app/Config/Paths.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class Paths
3535
*
3636
* NO TRAILING SLASH!
3737
*/
38-
public $appDirectory = __DIR__ . '/../../app';
38+
public $appDirectory = __DIR__ . '/..';
3939

4040
/*
4141
* ---------------------------------------------------------------
@@ -73,5 +73,5 @@ class Paths
7373
* default this is in `app/Views`. This value
7474
* is used when no value is provided to `Services::renderer()`.
7575
*/
76-
public $viewDirectory = __DIR__ . '/../../app/Views';
76+
public $viewDirectory = __DIR__ . '/../Views';
7777
}

contributing/README.rst

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ If you've found a critical vulnerability, we'd be happy to credit you in our
5454
Tips for a Good Issue Report
5555
****************************
5656

57-
Use a descriptive subject line (eg parser library chokes on commas) rather than a vague one (eg. your code broke).
57+
Use a descriptive subject line (eg parser library chokes on commas) rather than
58+
a vague one (eg. your code broke).
5859

5960
Address a single issue in a report.
6061

@@ -64,12 +65,13 @@ Explain what you expected to happen, and what did happen.
6465
Include error messages and stacktrace, if any.
6566

6667
Include short code segments if they help to explain.
67-
Use a pastebin or dropbox facility to include longer segments of code or screenshots - do not include them in the issue report itself.
68+
Use a pastebin or dropbox facility to include longer segments of code or
69+
screenshots - do not include them in the issue report itself.
6870
This means setting a reasonable expiry for those, until the issue is resolved or closed.
6971

7072
If you know how to fix the issue, you can do so in your own fork & branch, and submit a pull request.
7173
The issue report information above should be part of that.
7274

7375
If your issue report can describe the steps to reproduce the problem, that is great.
74-
If you can include a unit test that reproduces the problem, that is even better, as it gives whoever is fixing
75-
it a clearer target!
76+
If you can include a unit test that reproduces the problem, that is even better,
77+
as it gives whoever is fixing it a clearer target!

contributing/guidelines.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,12 @@ Change Log
6464

6565
The change-log, in the user guide root, needs to be kept up-to-date.
6666
Not all changes will need an entry in it, but new classes, major or BC changes
67-
to existing classes, and bug fixes should.
67+
to existing classes should. Once we have a stable release, bug fixes would
68+
appear in the changelog too.
6869

69-
See the `CodeIgniter 4 change log
70-
<https://github.com/codeigniter4/CodeIgniter/blob/develop/user_guide_src/source/changelog.rst>`_
71-
for an example.
70+
The changelog is independently maintained by the framework release manager
71+
Make sure that your PR descriptions help us decide if the contribution should
72+
be highlighted in the next release after it has been merged.
7273

7374
PHP Compatibility
7475
=================
@@ -89,7 +90,7 @@ with earlier versions of the framework.
8990
Mergeability
9091
============
9192

92-
Your PRs need to be mergeable before they will be considered.
93+
Your PRs need to be mergeable and GPG-signed before they will be considered.
9394

9495
We suggest that you synchronize your repository's ``develop`` branch with
9596
that in the main repository, and then your feature branch and

contributing/internals.rst

Lines changed: 62 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,19 @@
22
CodeIgniter Internals Overview
33
##############################
44

5-
This guide should help contributors understand how the core of the framework works, and what needs to be done
6-
when creating new functionality. Specifically, it details the information needed to create new packages for the
7-
core.
5+
This guide should help contributors understand how the core of the framework works,
6+
and what needs to be done when creating new functionality. Specifically, it
7+
details the information needed to create new packages for the core.
88

99
Dependencies
1010
============
1111

12-
All packages should be designed to be completely isolated from the rest of the packages. This will allow
13-
them to be used in projects outside of CodeIgniter. Basically, this means that all dependencies should be
14-
kept to a minimum. Any dependencies must be able to be passed into the constructor. If you do need to use one
15-
of the other core packages, you can create that in the constructor using the Services class, as long as you
16-
provide a way for dependencies to override that::
12+
All packages should be designed to be completely isolated from the rest of the
13+
packages, if possible. This will allow them to be used in projects outside of CodeIgniter.
14+
Basically, this means that any dependencies should be kept to a minimum.
15+
Any dependencies must be able to be passed into the constructor. If you do need to use one
16+
of the other core packages, you can create that in the constructor using the
17+
Services class, as long as you provide a way for dependencies to override that::
1718

1819
public function __construct(Foo $foo=null)
1920
{
@@ -26,91 +27,112 @@ Type hinting
2627
============
2728

2829
PHP7 provides the ability to `type hint <http://php.net/manual/en/functions.arguments.php#functions.arguments.type-declaration>`_
29-
method parameters and return types. Use it where possible. Return type hinting is not always practical, but do try to
30-
make it work.
30+
method parameters and return types. Use it where possible. Return type hinting
31+
is not always practical, but do try to make it work.
3132

3233
At this time, we are not using strict type hinting.
3334

3435
Abstractions
3536
============
3637

37-
The amount of abstraction required to implement a solution should be the minimal amount required. Every layer of
38-
abstraction brings additional levels of technical debt and unnecessary complexity. That said, don't be afraid to
39-
use it when it's needed and can help things.
38+
The amount of abstraction required to implement a solution should be the minimal
39+
amount required. Every layer of abstraction brings additional levels of technical
40+
debt and unnecessary complexity. That said, don't be afraid to use it when it's
41+
needed and can help things.
4042

4143
* Don't create a new container class when an array will do just fine.
4244
* Start simple, refactor as necessary to achieve clean separation of code, but don't overdo it.
4345

4446
Testing
4547
=======
4648

47-
Any new packages submitted to the framework must be accompanied by unit tests. The target is 80%+ coverage of all
48-
classes within the package.
49+
Any new packages submitted to the framework must be accompanied by unit tests.
50+
The target is 80%+ code coverage of all classes within the package.
4951

5052
* Test only public methods, not protected and private unless the method really needs it due to complexity.
5153
* Don't just test that the method works, but test for all fail states, thrown exceptions, and other pathways through your code.
5254

55+
You should be aware of the extra assertions that we have made, provisions for
56+
accessing private properties for testing, and mock services.
57+
We have also made a **CITestStreamFilter** to capture test output.
58+
Do check out similar tests in ``tests/system/``, and read the "Testing" section
59+
in the user guide, before you dig in to your own.
60+
61+
Some testing needs to be done in a separate process, in order to setup the
62+
PHP globals to mimic test situations properly. See
63+
``tests/system/HTTP/ResponseSendTest`` for an example of this.
64+
5365
Namespaces and Files
5466
====================
5567

56-
All new packages should live under the ``CodeIgniter`` namespace. The package itself will need its own sub-namespace
68+
All new packages should live under the ``CodeIgniter`` namespace.
69+
The package itself will need its own sub-namespace
5770
that collects all related files into one grouping, like ``CodeIgniter\HTTP``.
5871

59-
Files MUST be named the same as the class they hold, and they must match the :doc:`Style Guide <styleguide>`, meaning
60-
CamelCase class and file names. The should be in their own directory that matches the sub-namespace under the **system**
61-
directory.
72+
Files MUST be named the same as the class they hold, and they must match the
73+
:doc:`Style Guide <./styleguide.rst>`, meaning CamelCase class and file names.
74+
They should be in their own directory that matches the sub-namespace under the
75+
**system** directory.
6276

63-
The the Router as an example. The Router lives in the ``CodeIgniter\Router`` namespace. It has two classes,
64-
**RouteCollection** and **Router**, which are in the files, **system/Router/RouteCollection.php** and
77+
Take the Router class as an example. The Router lives in the ``CodeIgniter\Router``
78+
namespace. Its two main classes,
79+
**RouteCollection** and **Router**, are in the files **system/Router/RouteCollection.php** and
6580
**system/Router/Router.php** respectively.
6681

6782
Interfaces
6883
----------
6984

70-
Most base classes should have an interface defined for them. At the very least this allows them to be easily mocked
71-
and passed in other classes as a dependency without breaking the type-hinting. The interface names should match
72-
the name of the class with "Interface" appended to it, like ``RouteCollectionInterface``.
85+
Most base classes should have an interface defined for them.
86+
At the very least this allows them to be easily mocked
87+
and passed to other classes as a dependency, without breaking the type-hinting.
88+
The interface names should match the name of the class with "Interface" appended
89+
to it, like ``RouteCollectionInterface``.
7390

7491
The Router package mentioned above includes the
75-
``CodeIgniter\Router\RouterCollectionInterface`` and ``CodeIgniter\Router\RouterInterface``
92+
``CodeIgniter\Router\RouteCollectionInterface`` and ``CodeIgniter\Router\RouterInterface``
7693
interfaces to provide the abstractions for the two classes in the package.
7794

7895
Handlers
7996
--------
8097

81-
When a package supports multiple "drivers", the convention is to place them in a **Handlers** directory, and
82-
name the child classes as Handlers. You will often find that creating a ``BaseHandler`` the child classes can
83-
extend to be beneficial in keeping the code DRY.
98+
When a package supports multiple "drivers", the convention is to place them in
99+
a **Handlers** directory, and name the child classes as Handlers.
100+
You will often find that creating a ``BaseHandler``, that the child classes can
101+
extend, to be beneficial in keeping the code DRY.
84102

85103
See the Log and Session packages for examples.
86104

87105
Configuration
88106
=============
89107

90-
Should the package require user-configurable settings, you should create a new file just for that package under
91-
**application/Config**. The file name should generally match the package name.
108+
Should the package require user-configurable settings, you should create a new
109+
file just for that package under **app/Config**.
110+
The file name should generally match the package name.
92111

93112
Autoloader
94113
==========
95114

96-
All files within the package should be added to **system/Config/AutoloadConfig.php**, in the "classmap" property.
97-
This is only used for core framework files, and helps to minimize file system scans and keep performance high.
115+
All files within the package should be added to **system/Config/AutoloadConfig.php**,
116+
in the "classmap" property. This is only used for core framework files, and helps
117+
to minimize file system scans and keep performance high.
98118

99119
Command-Line Support
100120
====================
101121

102-
CodeIgniter has never been known for it's strong CLI support. However, if your package could benefit from it, create a
103-
new file under **system/Commands**. The class contained within is simply a controller that is intended for CLI
104-
usage only. The ``index()`` method should provide a list of available commands provided by that package.
122+
CodeIgniter has never been known for it's strong CLI support. However, if your
123+
package could benefit from it, create a new file under **system/Commands**.
124+
The class contained within is simply a controller that is intended for CLI
125+
usage only. The ``index()`` method should provide a list of available commands
126+
provided by that package.
105127

106-
Routes must be added to **system/Config/Routes.php** using the ``cli()`` method to ensure it is not accessible
107-
through the browser, but is restricted to the CLI only.
128+
Routes must be added to **system/Config/Routes.php** using the ``cli()`` method
129+
to ensure it is not accessible through the browser, but is restricted to the CLI only.
108130

109131
See the **MigrationsCommand** file for an example.
110132

111133
Documentation
112134
=============
113135

114-
All packages must contain appropriate documentation that matches the tone and style of the rest of the user guide.
115-
In most cases, the top portion of the package's page should be treated in tutorial fashion, while the second
116-
half would be a class reference.
136+
All packages must contain appropriate documentation that matches the tone and
137+
style of the rest of the user guide. In most cases, the top portion of the package's
138+
page should be treated in tutorial fashion, while the second half would be a class reference.

0 commit comments

Comments
 (0)