diff --git a/user_guide_src/source/cli/cli.rst b/user_guide_src/source/cli/cli.rst index 0e5cf61640..f99ff92d7a 100644 --- a/user_guide_src/source/cli/cli.rst +++ b/user_guide_src/source/cli/cli.rst @@ -49,7 +49,7 @@ in it:: } } -Then save the file to your **application/Controllers/** directory. +Then save the file to your **app/Controllers/** directory. Now normally you would visit the your site using a URL similar to this:: diff --git a/user_guide_src/source/cli/cli_commands.rst b/user_guide_src/source/cli/cli_commands.rst index d55f2cb43d..f74c8ebcc8 100644 --- a/user_guide_src/source/cli/cli_commands.rst +++ b/user_guide_src/source/cli/cli_commands.rst @@ -16,7 +16,7 @@ building out custom code generators for your company. Running Commands **************** -Commands are run from the command line, in the root directory. The same one that holds the **/application** +Commands are run from the command line, in the root directory. The same one that holds the **/app** and **/system** directories. A custom script, **spark** has been provided that is used to run any of the cli commands:: @@ -67,7 +67,7 @@ File Location ============= Commands must be stored within a directory named **Commands**. However, that directory can be located anywhere -that the :doc:`Autoloader ` can locate it. This could be in **/application/Commands**, or +that the :doc:`Autoloader ` can locate it. This could be in **/app/Commands**, or a directory that you keep commands in to use in all of your project development, like **Acme/Commands**. .. note:: When the commands are executed, the full CodeIgniter cli environment has been loaded, making it @@ -77,7 +77,7 @@ An Example Command ================== Let's step through an example command whose only function is to report basic information about the application -itself, for demonstration purposes. Start by creating a new file at **/application/Commands/AppInfo.php**. It +itself, for demonstration purposes. Start by creating a new file at **/app/Commands/AppInfo.php**. It should contain the following code:: ` @@ -77,7 +77,7 @@ The other responsibility of the controller is to handle everything that pertains authentication, web safety, encoding, etc. In short, the controller is where you make sure that people are allowed to be there, and they get the data they need in a format they can use. -Controllers are typically stored in **/application/Controllers**, though they can use a namespace to be grouped however +Controllers are typically stored in **/app/Controllers**, though they can use a namespace to be grouped however you need. :doc:`Find out more about controllers ` diff --git a/user_guide_src/source/concepts/services.rst b/user_guide_src/source/concepts/services.rst index 15e6509df1..f0d589078e 100644 --- a/user_guide_src/source/concepts/services.rst +++ b/user_guide_src/source/concepts/services.rst @@ -79,7 +79,7 @@ create a new class that implements the ``RouterCollectionInterface``:: // Implement required methods here. } -Finally, modify **/application/Config/Services.php** to create a new instance of ``MyRouter`` +Finally, modify **/app/Config/Services.php** to create a new instance of ``MyRouter`` instead of ``CodeIgniter\Router\RouterCollection``:: public static function routes() diff --git a/user_guide_src/source/concepts/structure.rst b/user_guide_src/source/concepts/structure.rst index a0d370d22e..66818a7298 100644 --- a/user_guide_src/source/concepts/structure.rst +++ b/user_guide_src/source/concepts/structure.rst @@ -8,18 +8,18 @@ can change to meet the needs of your application. Default Directories =================== -A fresh install has six directories: ``/application``, ``/system``, ``/public``, +A fresh install has six directories: ``/app``, ``/system``, ``/public``, ``/writable``, ``/tests`` and ``/docs``. Each of these directories has a very specific part to play. -application ------------ -The ``application`` directory is where all of your application code lives. This comes with a default directory +app +--- +The ``app`` directory is where all of your application code lives. This comes with a default directory structure that works well for many applications. The following folders make up the basic contents: .. code-block:: none - /application + /app /Config Stores the configuration files /Controllers Controllers determine the program flow /Database Stores the database migrations and seeds files @@ -31,7 +31,7 @@ structure that works well for many applications. The following folders make up t /ThirdParty ThirdParty libraries that can be used in application /Views Views make up the HTML that is displayed to the client. -Because the ``application`` directory is already namespaced, you should feel free to modify the structure +Because the ``app`` directory is already namespaced, you should feel free to modify the structure of this directory to suit your application's needs. For example, you might decide to start using the Repository pattern and Entity Models to work with your data. In this case, you could rename the ``Models`` directory to ``Repositories``, and add a new ``Entities`` directory. @@ -40,7 +40,7 @@ pattern and Entity Models to work with your data. In this case, you could rename routing to controllers, and will need to define all of your routes in the routes file. All files in this directory live under the ``App`` namespace, though you are free to change that in -**application/Config/Constants.php**. +**app/Config/Constants.php**. system ------ @@ -84,4 +84,4 @@ Modifying Directory Locations ----------------------------- If you've relocated any of the main directories, you can change the configuration -settings inside ``application/Config/Paths``. +settings inside ``app/Config/Paths``. diff --git a/user_guide_src/source/database/configuration.rst b/user_guide_src/source/database/configuration.rst index 6ef1aa0db6..458d22a1e5 100644 --- a/user_guide_src/source/database/configuration.rst +++ b/user_guide_src/source/database/configuration.rst @@ -8,7 +8,7 @@ Database Configuration CodeIgniter has a config file that lets you store your database connection values (username, password, database name, etc.). The config -file is located at application/Config/Database.php. You can also set +file is located at app/Config/Database.php. You can also set database connection values in the .env file. See below for more details. The config settings are stored in a class property that is an array with this diff --git a/user_guide_src/source/dbmgmt/migration.rst b/user_guide_src/source/dbmgmt/migration.rst index b107934d94..1bb28167ea 100644 --- a/user_guide_src/source/dbmgmt/migration.rst +++ b/user_guide_src/source/dbmgmt/migration.rst @@ -11,7 +11,7 @@ need to be run against the production machines next time you deploy. The database table **migration** tracks which migrations have already been run so all you have to do is update your application files and call ``$migration->current()`` to work out which migrations should be run. -The current version is found in **application/Config/Migrations.php**. +The current version is found in **app/Config/Migrations.php**. .. contents:: :local: @@ -36,7 +36,7 @@ method taken. Two numbering styles are available: the preferred scheme in CodeIgniter 3.0 and later. The desired style may be selected using the ``$type`` setting in your -*application/Config/Migrations.php* file. The default setting is timestamp. +*app/Config/Migrations.php* file. The default setting is timestamp. Regardless of which numbering style you choose to use, prefix your migration files with the migration number followed by an underscore and a descriptive @@ -50,7 +50,7 @@ Create a Migration ****************** This will be the first migration for a new site which has a blog. All -migrations go in the **application/Database/Migrations/** directory and have names such +migrations go in the **app/Database/Migrations/** directory and have names such as *20121031100537_Add_blog.php*. :: @@ -86,7 +86,7 @@ as *20121031100537_Add_blog.php*. } } -Then in **application/Config/Migrations.php** set ``$currentVersion = 20121031100537;``. +Then in **app/Config/Migrations.php** set ``$currentVersion = 20121031100537;``. The database connection and the database Forge class are both available to you through ``$this->db`` and ``$this->forge``, respectively. @@ -108,7 +108,7 @@ Database Groups =============== A migration will only be run against a single database group. If you have multiple groups defined in -**application/Config/Database.php**, then it will run against the ``$defaultGroup`` as specified +**app/Config/Database.php**, then it will run against the ``$defaultGroup`` as specified in that same configuration file. There may be times when you need different schemas for different database groups. Perhaps you have one database that is used for all general site information, while another database is used for mission critical data. You can ensure that migrations are run only @@ -128,7 +128,7 @@ Namespaces ========== The migration library can automatically scan all namespaces you have defined within -**application/Config/Autoload.php** and its ``$psr4`` property for matching directory +**app/Config/Autoload.php** and its ``$psr4`` property for matching directory names. It will include all migrations it finds in Database/Migrations. Each namespace has it's own version sequence, this will help you upgrade and downgrade each module (namespace) without affecting other namespaces. @@ -149,7 +149,7 @@ re-usable, modular code suites. Usage Example ************* -In this example some simple code is placed in **application/Controllers/Migrate.php** +In this example some simple code is placed in **app/Controllers/Migrate.php** to update the schema:: db`` and ``$this->forge``, respectively. Seed files must be -stored within the **application/Database/Seeds** directory. The name of the file must match the name of the class. +stored within the **app/Database/Seeds** directory. The name of the file must match the name of the class. :: - // application/Database/Seeds/SimpleSeeder.php + // app/Database/Seeds/SimpleSeeder.php class SimpleSeeder extends \CodeIgniter\Database\Seeder { public function run() diff --git a/user_guide_src/source/general/common_functions.rst b/user_guide_src/source/general/common_functions.rst index 8a2d844f6e..7229668d38 100755 --- a/user_guide_src/source/general/common_functions.rst +++ b/user_guide_src/source/general/common_functions.rst @@ -322,7 +322,7 @@ Core Constants .. php:const:: APPPATH - The path to the **application** directory. + The path to the **app** directory. .. php:const:: ROOTPATH diff --git a/user_guide_src/source/general/errors.rst b/user_guide_src/source/general/errors.rst index 7d6f2ab641..11bb186167 100644 --- a/user_guide_src/source/general/errors.rst +++ b/user_guide_src/source/general/errors.rst @@ -93,7 +93,7 @@ PageNotFoundException --------------------- This is used to signal a 404, Page Not Found error. When thrown, the system will show the view found at -``/application/views/errors/html/error_404.php``. You should customize all of the error views for your site. +``/app/views/errors/html/error_404.php``. You should customize all of the error views for your site. If, in ``Config/Routes.php``, you have specified a 404 Override, that will be called instead of the standard 404 page:: diff --git a/user_guide_src/source/installation/downloads.rst b/user_guide_src/source/installation/downloads.rst index cce40bce34..956d4e0f4c 100644 --- a/user_guide_src/source/installation/downloads.rst +++ b/user_guide_src/source/installation/downloads.rst @@ -2,32 +2,32 @@ Downloading CodeIgniter ####################### -The CodeIgniter 4 open source project has its own +The CodeIgniter 4 open source project has its own `Github organization `_. There are a number of repositories there of interest: -- `CodeIgniter4 `_ +- `CodeIgniter4 `_ holds the codebase for the project, including unit testing and the source from which the user guide is built. This would be used by contributors to the project. -- `framework `_ +- `framework `_ holds the released versions of the framework. This would be normally be used by developers. -- `appstarter `_ - holds the released application starter, with application +- `appstarter `_ + holds the released application starter, with app and public folders, but with only a composer dependency on the framework. This is meant as the easy way to start a CodeIgniter 4 project. -- `userguide `_ +- `userguide `_ holds the pre-built user guide. It can be downloaded on its own, or `viewed online `_. -- `translations `_ +- `translations `_ holds translations of the CodeIgniter 4 system messages. Developers can use this for :doc:`localization `. -- `coding-standard `_ +- `coding-standard `_ holds the coding conventions we use for source code that is - part of the framework itself. + part of the framework itself. It is a dependency of the codebase repository, for contributors. In all the above, the latest version of a repository can be downloaded diff --git a/user_guide_src/source/outgoing/response.rst b/user_guide_src/source/outgoing/response.rst index 9c33996d4c..93bb478986 100644 --- a/user_guide_src/source/outgoing/response.rst +++ b/user_guide_src/source/outgoing/response.rst @@ -155,12 +155,12 @@ Turning CSP On -------------- By default, support for this is off. To enable support in your application, edit the ``CSPEnabled`` value in -**application/Config/App.php**:: +**app/Config/App.php**:: public $CSPEnabled = true; When enabled, the response object will contain an instance of ``CodeIgniter\HTTP\ContentSecurityPolicy``. The -values set in **application/Config/ContentSecurityPolicy.php** are applied to that instance and, if no changes are +values set in **app/Config/ContentSecurityPolicy.php** are applied to that instance and, if no changes are needed during runtime, then the correctly formatted header is sent and you're all done. Runtime Configuration @@ -440,7 +440,7 @@ The methods provided by the parent class that are available are: The prefix is only needed if you need to avoid name collisions with other identically named cookies for your server. - + Provide a prefix if cookies should only be deleted for that subset. Provide a domain name if cookies should only be deleted for that domain. Provide a path name if cookies should only be deleted for that path. diff --git a/user_guide_src/source/outgoing/view_parser.rst b/user_guide_src/source/outgoing/view_parser.rst index 805a4f0eb6..410d182b55 100644 --- a/user_guide_src/source/outgoing/view_parser.rst +++ b/user_guide_src/source/outgoing/view_parser.rst @@ -440,7 +440,7 @@ See `PHP's NumberFormatter Custom Filters -------------- -You can easily create your own filters by editing **application/Config/View.php** and adding new entries to the +You can easily create your own filters by editing **app/Config/View.php** and adding new entries to the ``$filters`` array. Each key is the name of the filter is called by in the view, and its value is any valid PHP callable:: @@ -452,7 +452,7 @@ callable:: PHP Native functions as Filters ------------------------------- -You can easily use native php function as filters by editing **application/Config/View.php** and adding new entries to the +You can easily use native php function as filters by editing **app/Config/View.php** and adding new entries to the ``$filters`` array.Each key is the name of the native PHP function is called by in the view, and its value is any valid native PHP function prefixed with:: diff --git a/user_guide_src/source/testing/debugging.rst b/user_guide_src/source/testing/debugging.rst index ab79a8d6fc..d35bd21b16 100644 --- a/user_guide_src/source/testing/debugging.rst +++ b/user_guide_src/source/testing/debugging.rst @@ -61,11 +61,11 @@ Enabling the Toolbar The toolbar is enabled by default in any environment *except* production. It will be shown whenever the constant CI_DEBUG is defined and it's value is positive. This is defined in the boot files (i.e. -application/Config/Boot/development.php) and can be modified there to determine what environments it shows +app/Config/Boot/development.php) and can be modified there to determine what environments it shows itself in. The toolbar itself is displayed as an :doc:`After Filter `. You can stop it from ever -running by removing it from the ``$globals`` property of **application/Config/Filters.php**. +running by removing it from the ``$globals`` property of **app/Config/Filters.php**. Choosing What to Show --------------------- diff --git a/user_guide_src/source/testing/overview.rst b/user_guide_src/source/testing/overview.rst index 4e006a4128..0f11a0b729 100644 --- a/user_guide_src/source/testing/overview.rst +++ b/user_guide_src/source/testing/overview.rst @@ -216,7 +216,7 @@ parameter is the name of the property to set the value of. The third parameter i Mocking Services ================ -You will often find that you need to mock one of the services defined in **application/Config/Services.php** to limit +You will often find that you need to mock one of the services defined in **app/Config/Services.php** to limit your tests to only the code in question, while simulating various responses from the services. This is especially true when testing controllers and other integration testing. The **Services** class provides two methods to make this simple: ``injectMock()``, and ``reset()``. diff --git a/user_guide_src/source/tutorial/static_pages.rst b/user_guide_src/source/tutorial/static_pages.rst index c8a408eaea..52c2d0f061 100644 --- a/user_guide_src/source/tutorial/static_pages.rst +++ b/user_guide_src/source/tutorial/static_pages.rst @@ -24,7 +24,7 @@ you'll see URL patterns that match: As URL schemes become more complex, this may change. But for now, this is all we will need to know. -Create a file at *application/Controllers/Pages.php* with the following +Create a file at *app/Controllers/Pages.php* with the following code. :: @@ -53,7 +53,7 @@ Now that you've created your first method, it's time to make some basic page templates. We will be creating two "views" (page templates) that act as our page footer and header. -Create the header at *application/Views/templates/header.php* and add +Create the header at *app/Views/templates/header.php* and add the following code: :: @@ -70,7 +70,7 @@ the following code: The header contains the basic HTML code that you'll want to display before loading the main view, together with a heading. It will also output the ``$title`` variable, which we'll define later in the controller. -Now, create a footer at *application/Views/templates/footer.php* that +Now, create a footer at *app/Views/templates/footer.php* that includes the following code: :: @@ -84,7 +84,7 @@ Adding logic to the controller Earlier you set up a controller with a ``view()`` method. The method accepts one parameter, which is the name of the page to be loaded. The -static page templates will be located in the *application/Views/pages/* +static page templates will be located in the *app/Views/pages/* directory. In that directory, create two files named *home.php* and *about.php*. @@ -166,7 +166,7 @@ controller you made above produces... - ``localhost:8080/pages/view/about`` will show the "about" page that you made above, because we explicitly asked for it - ``localhost:8080/pages/view/shop`` will show a "404 - File Not Found" error page, - because there is no `application/Views/pages/shop.php` + because there is no `app/Views/pages/shop.php` Routing @@ -179,7 +179,7 @@ controller and method, and break free from the normal convention: ``http://example.com/[controller-class]/[controller-method]/[arguments]`` Let's do that. Open the routing file located at -*application/Config/Routes.php* and look for the "Route Definitions" +*app/Config/Routes.php* and look for the "Route Definitions" section of the configuration file. The only uncommented line there to start with should be:::