CodeIgniter4/installation/installing_composer.html
2023-10-22 21:43:30 +00:00

568 lines
38 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Composer Installation &mdash; CodeIgniter 4.4.2 documentation</title>
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../_static/css/citheme.css" type="text/css" />
<link rel="stylesheet" href="../_static/css/citheme_dark.css" type="text/css" />
<link rel="shortcut icon" href="../_static/favicon.ico"/>
<!--[if lt IE 9]>
<script src="../_static/js/html5shiv.min.js"></script>
<![endif]-->
<script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script>
<script src="../_static/jquery.js"></script>
<script src="../_static/underscore.js"></script>
<script src="../_static/doctools.js"></script>
<script src="../_static/js/citheme.js"></script>
<script src="../_static/js/carbon.js"></script>
<script src="../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="Manual Installation" href="installing_manual.html" />
<link rel="prev" title="Installation" href="index.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="../index.html">
<img src="../_static/ci-logo-text.svg" class="logo" alt="Logo"/>
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<ul>
<li class="toctree-l1"><a class="reference internal" href="../intro/index.html">Welcome to CodeIgniter4</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../intro/index.html">Welcome to CodeIgniter4</a></li>
<li class="toctree-l2"><a class="reference internal" href="../intro/requirements.html">Server Requirements</a></li>
<li class="toctree-l2"><a class="reference internal" href="../intro/credits.html">Credits</a></li>
<li class="toctree-l2"><a class="reference internal" href="../intro/psr.html">PSR Compliance</a></li>
<li class="toctree-l2"><a class="reference internal" href="../license.html">License Agreement</a></li>
</ul>
</li>
</ul>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="index.html">Installation</a><ul class="current">
<li class="toctree-l2 current"><a class="current reference internal" href="#">Composer Installation</a></li>
<li class="toctree-l2"><a class="reference internal" href="installing_manual.html">Manual Installation</a></li>
<li class="toctree-l2"><a class="reference internal" href="running.html">Running Your App</a></li>
<li class="toctree-l2"><a class="reference internal" href="troubleshooting.html">Troubleshooting</a></li>
<li class="toctree-l2"><a class="reference internal" href="../changelogs/index.html">Change Logs</a></li>
<li class="toctree-l2"><a class="reference internal" href="upgrading.html">Upgrading From a Previous Version</a></li>
<li class="toctree-l2"><a class="reference internal" href="repositories.html">CodeIgniter Repositories</a></li>
</ul>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../tutorial/index.html">Build Your First Application</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../tutorial/static_pages.html">Static Pages</a></li>
<li class="toctree-l2"><a class="reference internal" href="../tutorial/news_section.html">News Section</a></li>
<li class="toctree-l2"><a class="reference internal" href="../tutorial/create_news_items.html">Create News Items</a></li>
<li class="toctree-l2"><a class="reference internal" href="../tutorial/conclusion.html">Conclusion</a></li>
</ul>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../concepts/index.html">CodeIgniter4 Overview</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../concepts/structure.html">Application Structure</a></li>
<li class="toctree-l2"><a class="reference internal" href="../concepts/mvc.html">Models, Views, and Controllers</a></li>
<li class="toctree-l2"><a class="reference internal" href="../concepts/autoloader.html">Autoloading Files</a></li>
<li class="toctree-l2"><a class="reference internal" href="../concepts/services.html">Services</a></li>
<li class="toctree-l2"><a class="reference internal" href="../concepts/factories.html">Factories</a></li>
<li class="toctree-l2"><a class="reference internal" href="../concepts/http.html">Working with HTTP Requests</a></li>
<li class="toctree-l2"><a class="reference internal" href="../concepts/security.html">Security Guidelines</a></li>
</ul>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../general/index.html">General Topics</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../general/configuration.html">Configuration</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/urls.html">CodeIgniter URLs</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/helpers.html">Helper Functions</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/common_functions.html">Global Functions and Constants</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/logging.html">Logging Information</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/errors.html">Error Handling</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/caching.html">Web Page Caching</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/ajax.html">AJAX Requests</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/modules.html">Code Modules</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/managing_apps.html">Managing your Applications</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/environments.html">Handling Multiple Environments</a></li>
</ul>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../incoming/index.html">Controllers and Routing</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../incoming/routing.html">URI Routing</a></li>
<li class="toctree-l2"><a class="reference internal" href="../incoming/controllers.html">Controllers</a></li>
<li class="toctree-l2"><a class="reference internal" href="../incoming/filters.html">Controller Filters</a></li>
<li class="toctree-l2"><a class="reference internal" href="../incoming/message.html">HTTP Messages</a></li>
<li class="toctree-l2"><a class="reference internal" href="../incoming/request.html">Request Class</a></li>
<li class="toctree-l2"><a class="reference internal" href="../incoming/incomingrequest.html">IncomingRequest Class</a></li>
<li class="toctree-l2"><a class="reference internal" href="../incoming/content_negotiation.html">Content Negotiation</a></li>
<li class="toctree-l2"><a class="reference internal" href="../incoming/methodspoofing.html">HTTP Method Spoofing</a></li>
<li class="toctree-l2"><a class="reference internal" href="../incoming/restful.html">RESTful Resource Handling</a></li>
</ul>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../outgoing/index.html">Building Responses</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../outgoing/views.html">Views</a></li>
<li class="toctree-l2"><a class="reference internal" href="../outgoing/view_cells.html">View Cells</a></li>
<li class="toctree-l2"><a class="reference internal" href="../outgoing/view_renderer.html">View Renderer</a></li>
<li class="toctree-l2"><a class="reference internal" href="../outgoing/view_layouts.html">View Layouts</a></li>
<li class="toctree-l2"><a class="reference internal" href="../outgoing/view_parser.html">View Parser</a></li>
<li class="toctree-l2"><a class="reference internal" href="../outgoing/view_decorators.html">View Decorators</a></li>
<li class="toctree-l2"><a class="reference internal" href="../outgoing/table.html">HTML Table Class</a></li>
<li class="toctree-l2"><a class="reference internal" href="../outgoing/response.html">HTTP Responses</a></li>
<li class="toctree-l2"><a class="reference internal" href="../outgoing/api_responses.html">API Response Trait</a></li>
<li class="toctree-l2"><a class="reference internal" href="../outgoing/localization.html">Localization</a></li>
<li class="toctree-l2"><a class="reference internal" href="../outgoing/alternative_php.html">Alternate PHP Syntax for View Files</a></li>
</ul>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../database/index.html">Working with Databases</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../database/examples.html">Quick Start: Usage Examples</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/configuration.html">Database Configuration</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/connecting.html">Connecting to a Database</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/queries.html">Running Queries</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/results.html">Generating Query Results</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/helpers.html">Query Helper Functions</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/query_builder.html">Query Builder Class</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/transactions.html">Transactions</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/metadata.html">Getting MetaData</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/call_function.html">Custom Function Calls</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/events.html">Database Events</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/utilities.html">Database Utilities</a></li>
</ul>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../models/index.html">Modeling Data</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../models/model.html">Using CodeIgniter's Model</a></li>
<li class="toctree-l2"><a class="reference internal" href="../models/entities.html">Using Entity Classes</a></li>
</ul>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../dbmgmt/index.html">Managing Databases</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../dbmgmt/forge.html">Database Manipulation with Database Forge</a></li>
<li class="toctree-l2"><a class="reference internal" href="../dbmgmt/migration.html">Database Migrations</a></li>
<li class="toctree-l2"><a class="reference internal" href="../dbmgmt/seeds.html">Database Seeding</a></li>
<li class="toctree-l2"><a class="reference internal" href="../dbmgmt/db_commands.html">Database Commands</a></li>
</ul>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../libraries/index.html">Library Reference</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../libraries/caching.html">Caching Driver</a></li>
<li class="toctree-l2"><a class="reference internal" href="../libraries/cookies.html">Cookies</a></li>
<li class="toctree-l2"><a class="reference internal" href="../libraries/curlrequest.html">CURLRequest Class</a></li>
<li class="toctree-l2"><a class="reference internal" href="../libraries/email.html">Email Class</a></li>
<li class="toctree-l2"><a class="reference internal" href="../libraries/encryption.html">Encryption Service</a></li>
<li class="toctree-l2"><a class="reference internal" href="../libraries/files.html">Working with Files</a></li>
<li class="toctree-l2"><a class="reference internal" href="../libraries/file_collections.html">File Collections</a></li>
<li class="toctree-l2"><a class="reference internal" href="../libraries/honeypot.html">Honeypot Class</a></li>
<li class="toctree-l2"><a class="reference internal" href="../libraries/images.html">Image Manipulation Class</a></li>
<li class="toctree-l2"><a class="reference internal" href="../libraries/pagination.html">Pagination</a></li>
<li class="toctree-l2"><a class="reference internal" href="../libraries/publisher.html">Publisher</a></li>
<li class="toctree-l2"><a class="reference internal" href="../libraries/security.html">Security</a></li>
<li class="toctree-l2"><a class="reference internal" href="../libraries/sessions.html">Session Library</a></li>
<li class="toctree-l2"><a class="reference internal" href="../libraries/throttler.html">Throttler</a></li>
<li class="toctree-l2"><a class="reference internal" href="../libraries/time.html">Times and Dates</a></li>
<li class="toctree-l2"><a class="reference internal" href="../libraries/typography.html">Typography</a></li>
<li class="toctree-l2"><a class="reference internal" href="../libraries/uploaded_files.html">Working with Uploaded Files</a></li>
<li class="toctree-l2"><a class="reference internal" href="../libraries/uri.html">Working with URIs</a></li>
<li class="toctree-l2"><a class="reference internal" href="../libraries/user_agent.html">User Agent Class</a></li>
<li class="toctree-l2"><a class="reference internal" href="../libraries/validation.html">Validation</a></li>
</ul>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../helpers/index.html">Helpers</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../helpers/array_helper.html">Array Helper</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/cookie_helper.html">Cookie Helper</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/date_helper.html">Date Helper</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/filesystem_helper.html">Filesystem Helper</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/form_helper.html">Form Helper</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/html_helper.html">HTML Helper</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/inflector_helper.html">Inflector Helper</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/number_helper.html">Number Helper</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/security_helper.html">Security Helper</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/test_helper.html">Test Helper</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/text_helper.html">Text Helper</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/url_helper.html">URL Helper</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/xml_helper.html">XML Helper</a></li>
</ul>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../testing/index.html">Testing</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../testing/overview.html">Getting Started</a></li>
<li class="toctree-l2"><a class="reference internal" href="../testing/database.html">Database</a></li>
<li class="toctree-l2"><a class="reference internal" href="../testing/fabricator.html">Generating Data</a></li>
<li class="toctree-l2"><a class="reference internal" href="../testing/controllers.html">Controller Testing</a></li>
<li class="toctree-l2"><a class="reference internal" href="../testing/feature.html">HTTP Testing</a></li>
<li class="toctree-l2"><a class="reference internal" href="../testing/response.html">Testing Responses</a></li>
<li class="toctree-l2"><a class="reference internal" href="../testing/benchmark.html">Benchmarking</a></li>
<li class="toctree-l2"><a class="reference internal" href="../testing/debugging.html">Debugging Your Application</a></li>
<li class="toctree-l2"><a class="reference internal" href="../testing/mocking.html">Mocking</a></li>
</ul>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../cli/index.html">Command Line Usage</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../cli/cli_overview.html">CLI Overview</a></li>
<li class="toctree-l2"><a class="reference internal" href="../cli/cli_controllers.html">Running Controllers via CLI</a></li>
<li class="toctree-l2"><a class="reference internal" href="../cli/spark_commands.html">Spark Commands</a></li>
<li class="toctree-l2"><a class="reference internal" href="../cli/cli_commands.html">Creating Spark Commands</a></li>
<li class="toctree-l2"><a class="reference internal" href="../cli/cli_generators.html">CLI Generators</a></li>
<li class="toctree-l2"><a class="reference internal" href="../cli/cli_library.html">CLI Library</a></li>
<li class="toctree-l2"><a class="reference internal" href="../cli/cli_request.html">CLIRequest Class</a></li>
</ul>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../extending/index.html">Extending CodeIgniter</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../extending/core_classes.html">Creating Core System Classes</a></li>
<li class="toctree-l2"><a class="reference internal" href="../extending/common.html">Replacing Common Functions</a></li>
<li class="toctree-l2"><a class="reference internal" href="../extending/events.html">Events</a></li>
<li class="toctree-l2"><a class="reference internal" href="../extending/basecontroller.html">Extending the Controller</a></li>
<li class="toctree-l2"><a class="reference internal" href="../extending/authentication.html">Authentication</a></li>
<li class="toctree-l2"><a class="reference internal" href="../extending/composer_packages.html">Creating Composer Packages</a></li>
<li class="toctree-l2"><a class="reference internal" href="../extending/contributing.html">Contributing to CodeIgniter</a></li>
</ul>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../libraries/official_packages.html">Official Packages</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="../index.html">CodeIgniter</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<a class="btn btn-neutral float-right" href="https://github.com/codeigniter4/CodeIgniter4/edit/develop/user_guide_src/source/installation/installing_composer.rst">Edit this page</a>
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="../index.html" class="icon icon-home" aria-label="Home"></a></li>
<li class="breadcrumb-item"><a href="index.html">Installation</a></li>
<li class="breadcrumb-item active">Composer Installation</li>
<li class="wy-breadcrumbs-aside">
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section id="composer-installation">
<h1>Composer Installation<a class="headerlink" href="#composer-installation" title="Permalink to this headline"></a></h1>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><p><a class="reference internal" href="#app-starter" id="id8">App Starter</a></p>
<ul>
<li><p><a class="reference internal" href="#installation" id="id9">Installation</a></p></li>
<li><p><a class="reference internal" href="#initial-configuration" id="id10">Initial Configuration</a></p></li>
<li><p><a class="reference internal" href="#upgrading" id="id11">Upgrading</a></p></li>
<li><p><a class="reference internal" href="#pros" id="id12">Pros</a></p></li>
<li><p><a class="reference internal" href="#cons" id="id13">Cons</a></p></li>
<li><p><a class="reference internal" href="#structure" id="id14">Structure</a></p></li>
<li><p><a class="reference internal" href="#latest-dev" id="id15">Latest Dev</a></p></li>
</ul>
</li>
<li><p><a class="reference internal" href="#adding-codeigniter4-to-an-existing-project" id="id16">Adding CodeIgniter4 to an Existing Project</a></p>
<ul>
<li><p><a class="reference internal" href="#id1" id="id17">Installation</a></p></li>
<li><p><a class="reference internal" href="#setting-up" id="id18">Setting Up</a></p></li>
<li><p><a class="reference internal" href="#id2" id="id19">Initial Configuration</a></p></li>
<li><p><a class="reference internal" href="#adding-codeigniter4-upgrading" id="id20">Upgrading</a></p></li>
<li><p><a class="reference internal" href="#id4" id="id21">Pros</a></p></li>
<li><p><a class="reference internal" href="#id5" id="id22">Cons</a></p></li>
<li><p><a class="reference internal" href="#id7" id="id23">Structure</a></p></li>
</ul>
</li>
<li><p><a class="reference internal" href="#translations-installation" id="id24">Translations Installation</a></p></li>
</ul>
</div>
<p>Composer can be used in several ways to install CodeIgniter4 on your system.</p>
<div class="admonition important">
<p class="admonition-title">Important</p>
<p>CodeIgniter4 requires Composer 2.0.14 or later.</p>
</div>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>If you are not familiar with Composer, we recommend you read
<a class="reference external" href="https://getcomposer.org/doc/01-basic-usage.md">Basic usage</a> first.</p>
</div>
<p>The first technique describes creating a skeleton project
using CodeIgniter4, that you would then use as the base for a new webapp.
The second technique described below lets you add CodeIgniter4 to an existing
webapp,</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>If you are using a Git repository to store your code, or for
collaboration with others, then the <strong>vendor</strong> folder would normally
be “git ignored”. In such a case, you will need to do a <code class="docutils literal notranslate"><span class="pre">composer</span> <span class="pre">update</span></code>
when you clone the repository to a new system.</p>
</div>
<section id="app-starter">
<h2><a class="toc-backref" href="#id8">App Starter</a><a class="headerlink" href="#app-starter" title="Permalink to this headline"></a></h2>
<p>The <a class="reference external" href="https://github.com/codeigniter4/appstarter">CodeIgniter 4 app starter</a>
repository holds a skeleton application, with a composer dependency on
the latest released version of the framework.</p>
<p>This installation technique would suit a developer who wishes to start
a new CodeIgniter4 based project.</p>
<section id="installation">
<h3><a class="toc-backref" href="#id9">Installation</a><a class="headerlink" href="#installation" title="Permalink to this headline"></a></h3>
<p>In the folder above your project root:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="go">composer create-project codeigniter4/appstarter project-root</span>
</pre></div>
</div>
<p>The command above will create a <strong>project-root</strong> folder.</p>
<p>If you omit the “project-root” argument, the command will create an
“appstarter” folder, which can be renamed as appropriate.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Before v4.4.0, CodeIgniter autoloader did not allow special
characters that are illegal in filenames on certain operating systems.
The symbols that can be used are <code class="docutils literal notranslate"><span class="pre">/</span></code>, <code class="docutils literal notranslate"><span class="pre">_</span></code>, <code class="docutils literal notranslate"><span class="pre">.</span></code>, <code class="docutils literal notranslate"><span class="pre">:</span></code>, <code class="docutils literal notranslate"><span class="pre">\</span></code> and space.
So if you installed CodeIgniter under the folder that contains the special
characters like <code class="docutils literal notranslate"><span class="pre">(</span></code>, <code class="docutils literal notranslate"><span class="pre">)</span></code>, etc., CodeIgniter didnt work. Since v4.4.0,
this restriction has been removed.</p>
</div>
<div class="admonition important">
<p class="admonition-title">Important</p>
<p>When you deploy to your production server, dont forget to run the
following command:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="go">composer install --no-dev</span>
</pre></div>
</div>
<p>The above command will remove the Composer packages only for development
that are not needed in the production environment. This will greatly reduce
the vendor folder size.</p>
</div>
</section>
<section id="initial-configuration">
<h3><a class="toc-backref" href="#id10">Initial Configuration</a><a class="headerlink" href="#initial-configuration" title="Permalink to this headline"></a></h3>
<p>After installation, a few initial configurations are required.
See <a class="reference internal" href="running.html#initial-configuration"><span class="std std-ref">Initial Configuration</span></a> for the details.</p>
</section>
<section id="upgrading">
<span id="app-starter-upgrading"></span><h3><a class="toc-backref" href="#id11">Upgrading</a><a class="headerlink" href="#upgrading" title="Permalink to this headline"></a></h3>
<p>Whenever there is a new release, then from the command line in your project root:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="go">composer update</span>
</pre></div>
</div>
<p>Read the <a class="reference internal" href="upgrading.html"><span class="doc">upgrade instructions</span></a>, and check Breaking Changes and Enhancements.</p>
</section>
<section id="pros">
<h3><a class="toc-backref" href="#id12">Pros</a><a class="headerlink" href="#pros" title="Permalink to this headline"></a></h3>
<p>Simple installation; easy to update.</p>
</section>
<section id="cons">
<h3><a class="toc-backref" href="#id13">Cons</a><a class="headerlink" href="#cons" title="Permalink to this headline"></a></h3>
<p>You still need to check for file changes in the <strong>project space</strong>
(root, app, public, writable) and merge them after updating.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>There are some third-party CodeIgniter modules available to assist
with merging changes to the project space:
<a class="reference external" href="https://packagist.org/explore/?query=codeigniter4%20updates">Explore on Packagist</a>.</p>
</div>
</section>
<section id="structure">
<h3><a class="toc-backref" href="#id14">Structure</a><a class="headerlink" href="#structure" title="Permalink to this headline"></a></h3>
<p>Folders in your project after set up:</p>
<ul class="simple">
<li><p>app, public, tests, writable</p></li>
<li><p>vendor/codeigniter4/framework/system</p></li>
</ul>
</section>
<section id="latest-dev">
<h3><a class="toc-backref" href="#id15">Latest Dev</a><a class="headerlink" href="#latest-dev" title="Permalink to this headline"></a></h3>
<p>The App Starter repo comes with a <code class="docutils literal notranslate"><span class="pre">builds</span></code> scripts to switch Composer sources between the
current stable release and the latest development branch of the framework. Use this script
for a developer who is willing to live with the latest unreleased changes, which may be unstable.</p>
<p>The <a class="reference external" href="https://codeigniter4.github.io/CodeIgniter4/">development user guide</a> is accessible online.
Note that this differs from the released user guide, and will pertain to the
develop branch explicitly.</p>
<section id="update-for-latest-dev">
<h4>Update for Latest Dev<a class="headerlink" href="#update-for-latest-dev" title="Permalink to this headline"></a></h4>
<p>In your project root:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="go">php builds development</span>
</pre></div>
</div>
<p>The command above will update <strong>composer.json</strong> to point to the <code class="docutils literal notranslate"><span class="pre">develop</span></code> branch of the
working repository, and update the corresponding paths in config and XML files.</p>
<p>After using the <code class="docutils literal notranslate"><span class="pre">builds</span></code> command be sure to run <code class="docutils literal notranslate"><span class="pre">composer</span> <span class="pre">update</span></code> to sync your vendor
folder with the latest target build. Then, check the <a class="reference internal" href="upgrading.html"><span class="doc">Upgrading From a Previous Version</span></a> and update project
files if necessary.</p>
</section>
<section id="next-minor-version">
<h4>Next Minor Version<a class="headerlink" href="#next-minor-version" title="Permalink to this headline"></a></h4>
<p>If you want to use the next minor version branch, after using the <code class="docutils literal notranslate"><span class="pre">builds</span></code> command
edit <strong>composer.json</strong> manually.</p>
<p>If you try the <code class="docutils literal notranslate"><span class="pre">4.4</span></code> branch, change the version to <code class="docutils literal notranslate"><span class="pre">4.4.x-dev</span></code>:</p>
<div class="highlight-html+php notranslate"><div class="highlight"><pre><span></span><span class="s2">&quot;require&quot;</span><span class="o">:</span> <span class="p">{</span>
<span class="s2">&quot;php&quot;</span><span class="o">:</span> <span class="s2">&quot;^7.4 || ^8.0&quot;</span><span class="p">,</span>
<span class="s2">&quot;codeigniter4/codeigniter4&quot;</span><span class="o">:</span> <span class="s2">&quot;4.4.x-dev&quot;</span>
<span class="p">},</span>
</pre></div>
</div>
<p>And run <code class="docutils literal notranslate"><span class="pre">composer</span> <span class="pre">update</span></code> to sync your vendor
folder with the latest target build. Then, check the Upgrading Guide
(<strong>user_guide_src/source/installation/upgrade_{version}.rst</strong>) and
update project files if necessary.</p>
</section>
<section id="revert-to-stable-release">
<h4>Revert to Stable Release<a class="headerlink" href="#revert-to-stable-release" title="Permalink to this headline"></a></h4>
<p>To revert the changes run:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="go">php builds release</span>
</pre></div>
</div>
</section>
</section>
</section>
<section id="adding-codeigniter4-to-an-existing-project">
<h2><a class="toc-backref" href="#id16">Adding CodeIgniter4 to an Existing Project</a><a class="headerlink" href="#adding-codeigniter4-to-an-existing-project" title="Permalink to this headline"></a></h2>
<p>The same <a class="reference external" href="https://github.com/codeigniter4/framework">CodeIgniter 4 framework</a>
repository described in “Manual Installation” can also be added to an
existing project using Composer.</p>
<section id="id1">
<h3><a class="toc-backref" href="#id17">Installation</a><a class="headerlink" href="#id1" title="Permalink to this headline"></a></h3>
<p>Develop your app inside the <code class="docutils literal notranslate"><span class="pre">app</span></code> folder, and the <code class="docutils literal notranslate"><span class="pre">public</span></code> folder
will be your document root.</p>
<p>In your project root:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="go">composer require codeigniter4/framework</span>
</pre></div>
</div>
<div class="admonition important">
<p class="admonition-title">Important</p>
<p>When you deploy to your production server, dont forget to run the
following command:</p>
</div>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="go">composer install --no-dev</span>
<span class="go">The above command will remove the Composer packages only for development</span>
<span class="go">that are not needed in the production environment. This will greatly reduce</span>
<span class="go">the vendor folder size.</span>
</pre></div>
</div>
</section>
<section id="setting-up">
<h3><a class="toc-backref" href="#id18">Setting Up</a><a class="headerlink" href="#setting-up" title="Permalink to this headline"></a></h3>
<blockquote>
<div><ol class="arabic simple">
<li><p>Copy the <strong>app</strong>, <strong>public</strong>, <strong>tests</strong> and <strong>writable</strong> folders from <strong>vendor/codeigniter4/framework</strong> to your project root</p></li>
<li><p>Copy the <strong>env</strong>, <strong>phpunit.xml.dist</strong> and <strong>spark</strong> files, from <strong>vendor/codeigniter4/framework</strong> to your project root</p></li>
<li><p>You will have to adjust the <code class="docutils literal notranslate"><span class="pre">$systemDirectory</span></code> property in <strong>app/Config/Paths.php</strong> to refer to the vendor one, e.g., <code class="docutils literal notranslate"><span class="pre">__DIR__</span> <span class="pre">.</span> <span class="pre">'/../../vendor/codeigniter4/framework/system'</span></code>.</p></li>
</ol>
</div></blockquote>
</section>
<section id="id2">
<h3><a class="toc-backref" href="#id19">Initial Configuration</a><a class="headerlink" href="#id2" title="Permalink to this headline"></a></h3>
<p>A few initial configurations are required.
See <a class="reference internal" href="running.html#initial-configuration"><span class="std std-ref">Initial Configuration</span></a> for the details.</p>
</section>
<section id="adding-codeigniter4-upgrading">
<span id="id3"></span><h3><a class="toc-backref" href="#id20">Upgrading</a><a class="headerlink" href="#adding-codeigniter4-upgrading" title="Permalink to this headline"></a></h3>
<p>Whenever there is a new release, then from the command line in your project root:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="go">composer update</span>
</pre></div>
</div>
<p>Read the <a class="reference internal" href="upgrading.html"><span class="doc">upgrade instructions</span></a>, and check Breaking Changes and Enhancements.</p>
</section>
<section id="id4">
<h3><a class="toc-backref" href="#id21">Pros</a><a class="headerlink" href="#id4" title="Permalink to this headline"></a></h3>
<p>Relatively simple installation; easy to update.</p>
</section>
<section id="id5">
<h3><a class="toc-backref" href="#id22">Cons</a><a class="headerlink" href="#id5" title="Permalink to this headline"></a></h3>
<p>You still need to check for file changes in the <strong>project space</strong>
(root, app, public, writable) after updating.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>There are some third-party CodeIgniter modules available to assist
with merging changes to the project space:
<a class="reference external" href="https://packagist.org/explore/?query=codeigniter4%20updates">Explore on Packagist</a>.</p>
</div>
</section>
<section id="id7">
<h3><a class="toc-backref" href="#id23">Structure</a><a class="headerlink" href="#id7" title="Permalink to this headline"></a></h3>
<p>Folders in your project after set up:</p>
<ul class="simple">
<li><p>app, public, tests, writable</p></li>
<li><p>vendor/codeigniter4/framework/system</p></li>
</ul>
</section>
</section>
<section id="translations-installation">
<h2><a class="toc-backref" href="#id24">Translations Installation</a><a class="headerlink" href="#translations-installation" title="Permalink to this headline"></a></h2>
<p>If you want to take advantage of the system message translations,
they can be added to your project in a similar fashion.</p>
<p>From the command line inside your project root:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="go">composer require codeigniter4/translations</span>
</pre></div>
</div>
<p>These will be updated along with the framework whenever you do a <code class="docutils literal notranslate"><span class="pre">composer</span> <span class="pre">update</span></code>.</p>
</section>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="index.html" class="btn btn-neutral float-left" title="Installation" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="installing_manual.html" class="btn btn-neutral float-right" title="Manual Installation" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2019-2023 CodeIgniter Foundation.
<span class="lastupdated">Last updated on Oct 22, 2023.
</span></p>
</div>
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(false);
});
</script>
</body>
</html>