|
| 1 | +Composer Installation |
| 2 | +############################################################################### |
| 3 | + |
| 4 | +Composer can be used in several ways to install CodeIgniter4 on your system. |
| 5 | + |
| 6 | +The first two techniques describe creating a skeleton project |
| 7 | +using CodeIgniter4, that you would then use as the base for a new webapp. |
| 8 | +The third technique described below lets you add CodeIgniter4 to an existing |
| 9 | +webapp, |
| 10 | + |
| 11 | +**Note**: if you are using a Git repository to store your code, or for |
| 12 | +collaboration with others, then the ``vendor`` folder would normally |
| 13 | +be "git ignored". In such a case, you will need to do a ``composer udpate`` |
| 14 | +when you clone the repository to a new system. |
| 15 | + |
| 16 | +App Starter |
| 17 | +============================================================ |
| 18 | + |
| 19 | +The `CodeIgniter 4 app starter <https://github.com/codeigniter4/appstarter>`_ |
| 20 | +repository holds a skeleton application, with a composer dependency on |
| 21 | +the latest released version of the framework. |
| 22 | + |
| 23 | +This installation technique would suit a developer who wishes to start |
| 24 | +a new CodeIgniter4 based project. |
| 25 | + |
| 26 | +Installation |
| 27 | +------------------------------------------------------- |
| 28 | + |
| 29 | +In the folder above your project root:: |
| 30 | + |
| 31 | + composer create-project codeigniter4/appstarter -s alpha |
| 32 | + |
| 33 | +Setup |
| 34 | +------------------------------------------------------- |
| 35 | + |
| 36 | +The command above will create an "appstarter" folder. |
| 37 | +Feel free to rename that for your project. |
| 38 | + |
| 39 | +Upgrading |
| 40 | +------------------------------------------------------- |
| 41 | + |
| 42 | +Whenever there is a new release, then from the command line in your project root:: |
| 43 | + |
| 44 | + composer update |
| 45 | + |
| 46 | +Read the upgrade instructions, and check designated ``app/Config`` folders for affected changes. |
| 47 | + |
| 48 | +Pros |
| 49 | +------------------------------------------------------- |
| 50 | + |
| 51 | +Simple installation; easy to update |
| 52 | + |
| 53 | +Cons |
| 54 | +------------------------------------------------------- |
| 55 | + |
| 56 | +You still need to check for ``app/Config`` changes after updating |
| 57 | + |
| 58 | +Structure |
| 59 | +------------------------------------------------------- |
| 60 | + |
| 61 | +Folders in your project after setup: |
| 62 | + |
| 63 | +- app, public, writable |
| 64 | +- vendor/codeigniter4/framework/system |
| 65 | +- vendor/codeigniter4/codeigniter4/app & public (compare with yours after updating) |
| 66 | + |
| 67 | +Dev Starter |
| 68 | +============================================================ |
| 69 | + |
| 70 | +Installation |
| 71 | +------------------------------------------------------- |
| 72 | + |
| 73 | +The `CodeIgniter 4 dev starter <https://github.com/codeigniter4/devstarter>`_ |
| 74 | +repository holds a skeleton application, just like the appstarter above, |
| 75 | +but with a composer dependency on |
| 76 | +the develop branch (unreleased) of the framework. |
| 77 | +It can be composer-installed as described here. |
| 78 | + |
| 79 | +This installation technique would suit a developer who wishes to start |
| 80 | +a new CodeIgniter4 based project, and who is willing to live with the |
| 81 | +latest unreleased changes, which may be unstable. |
| 82 | + |
| 83 | +The `development user guide <https://codeigniter4.github.io/CodeIgniter4/>`_ is accessible online. |
| 84 | +Note that this differs from the released user guide, and will pertain to the |
| 85 | +develop branch explicitly. |
| 86 | + |
| 87 | +In the folder above your project root:: |
| 88 | + |
| 89 | + composer create-project codeigniter4/devstarter -s dev |
| 90 | + |
| 91 | +Setup |
| 92 | +------------------------------------------------------- |
| 93 | + |
| 94 | +The command above will create an "devstarter" folder. |
| 95 | +Feel free to rename that for your project. |
| 96 | + |
| 97 | +Upgrading |
| 98 | +------------------------------------------------------- |
| 99 | + |
| 100 | +``composer update`` whenever you are ready for the latest changes. |
| 101 | + |
| 102 | +Check the changelog to see if any recent changes affect your app, |
| 103 | +bearing in mind that the most recent changes may not have made it |
| 104 | +into the changelog! |
| 105 | + |
| 106 | +Pros |
| 107 | +------------------------------------------------------- |
| 108 | + |
| 109 | +Simple installation; easy to update; bleeding edge version |
| 110 | + |
| 111 | +Cons |
| 112 | +------------------------------------------------------- |
| 113 | + |
| 114 | +This is not guaranteed to be stable; the onus is on you to upgrade. |
| 115 | +You still need to check for ``app/Config`` changes after updating. |
| 116 | + |
| 117 | +Structure |
| 118 | +------------------------------------------------------- |
| 119 | + |
| 120 | +Folders in your project after setup: |
| 121 | + |
| 122 | +- app, public, writable |
| 123 | +- vendor/codeigniter4/codeigniter4/system |
| 124 | +- vendor/codeigniter4/codeigniter4/app & public (compare with yours after updating) |
| 125 | + |
| 126 | +Adding CodeIgniter4 to an Existing Project |
| 127 | +============================================================ |
| 128 | + |
| 129 | +The same `CodeIgniter 4 framework <https://github.com/codeigniter4/framework>`_ |
| 130 | +repository described in "Manual Installation" can also be added to an |
| 131 | +existing project using Composer. |
| 132 | + |
| 133 | +Develop your app inside the ``app`` folder, and the ``public`` folder |
| 134 | +will be your document root. |
| 135 | + |
| 136 | +In your project root:: |
| 137 | + |
| 138 | + composer require codeigniter4/framework @alpha |
| 139 | + |
| 140 | +Setup |
| 141 | +------------------------------------------------------- |
| 142 | + |
| 143 | +Copy the app, public and writable folders from ``vendor/codeigniter4/framework`` |
| 144 | +to your project root |
| 145 | + |
| 146 | +Copy the ``env``, ``phpunit.xml.dist`` and ``spark`` files, from |
| 147 | +``vendor/codeigniter4/framework`` to your project root |
| 148 | + |
| 149 | +You will have to adjust paths to refer to vendor/codeigniter/framework``, |
| 150 | +- the $systemDirectory variable in ``app/Config/Paths.php`` |
| 151 | + |
| 152 | +Upgrading |
| 153 | +------------------------------------------------------- |
| 154 | + |
| 155 | +Whenever there is a new release, then from the command line in your project root:: |
| 156 | + |
| 157 | + composer update |
| 158 | + |
| 159 | +Read the upgrade instructions, and check designated |
| 160 | +``app/Config`` folders for affected changes. |
| 161 | + |
| 162 | +Pros |
| 163 | +------------------------------------------------------- |
| 164 | + |
| 165 | +Relatively simple installation; easy to update |
| 166 | + |
| 167 | +Cons |
| 168 | +------------------------------------------------------- |
| 169 | + |
| 170 | +You still need to check for ``app/Config`` changes after updating |
| 171 | + |
| 172 | +Structure |
| 173 | +------------------------------------------------------- |
| 174 | + |
| 175 | +Folders in your project after setup: |
| 176 | + |
| 177 | +- app, public, writable |
| 178 | +- vendor/codeigniter4/framework/system |
| 179 | + |
| 180 | + |
| 181 | +Translations Installation |
| 182 | +============================================================ |
| 183 | + |
| 184 | +If you want to take advantage of the system message translations, |
| 185 | +they can be added to your project in a similar fashion. |
| 186 | + |
| 187 | +From the command line inside your project root:: |
| 188 | + |
| 189 | + composer require codeigniter4/translations |
| 190 | + |
| 191 | +These will be updated along with the framework whenever you do a ``composer update``. |
0 commit comments