nhance/app/Views/docs/partials/installation_content.php
2026-05-18 12:28:19 +05:30

125 lines
3.9 KiB
PHP
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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.

<?php
/**
* Installation — content only
* app/Views/docs/installation.php
*
* ⚠️ NO layout partials here. The controller wraps this automatically.
* Just write your h2, p, pre, table, callout blocks.
*
* Available $data variables injected by the controller:
* $title, $breadcrumb, $toc, $last_updated, $author, $read_time, $prev, $next
*/
?>
<p>
This guide walks you through setting up the project on a local development machine.
For production deployment, see the <a href="<?= base_url('docs/deployment') ?>">Deployment</a> page.
</p>
<div class="callout info">
<span></span>
<div>
<strong>Before you begin</strong>
Make sure PHP 8.1+, Composer 2.x, and MySQL 5.7+ are installed on your machine.
</div>
</div>
<!-- REQUIREMENTS -->
<h2 id="requirements">Requirements</h2>
<table>
<thead>
<tr><th>Dependency</th><th>Version</th><th>Notes</th></tr>
</thead>
<tbody>
<tr><td><code>PHP</code></td><td>8.1+</td><td>Required by CI 4.4+</td></tr>
<tr><td><code>MySQL</code></td><td>5.7 / 8.0</td><td>Primary database</td></tr>
<tr><td><code>Composer</code></td><td>2.x</td><td>Dependency management</td></tr>
<tr><td><code>Node.js</code></td><td>18+ (optional)</td><td>Only for asset pipeline</td></tr>
</tbody>
</table>
<!-- STEPS -->
<h2 id="steps">Steps</h2>
<ol class="steps">
<li>
<strong id="clone">Clone the repository</strong>
<div class="code-header">
<span class="code-filename">terminal</span>
<span class="code-lang">bash</span>
</div>
<pre><code class="language-bash">git clone https://github.com/your-org/myapp.git
cd myapp</code></pre>
</li>
<li>
<strong>Install PHP dependencies</strong>
<pre><code class="language-bash">composer install</code></pre>
</li>
<li>
<strong>Copy the environment file</strong>
<pre><code class="language-bash">cp env .env</code></pre>
<p>Edit <code>.env</code> with your local database credentials and base URL.</p>
</li>
<li>
<strong id="migrate">Run migrations and seeders</strong>
<pre><code class="language-bash">php spark migrate
php spark db:seed MainSeeder</code></pre>
</li>
<li>
<strong>Start the dev server</strong>
<pre><code class="language-bash">php spark serve</code></pre>
<p>App will be available at <code>http://localhost:8080</code>.</p>
</li>
</ol>
<div class="callout warning">
<span>⚠️</span>
<div>
<strong>Use 127.0.0.1, not localhost</strong>
MySQL on some setups resolves <code>localhost</code> to a socket path instead of TCP.
Use <code>127.0.0.1</code> in <code>.env</code> to avoid connection errors.
</div>
</div>
<!-- CONFIGURATION -->
<h2 id="configuration">Configuration</h2>
<p>Key variables to configure in <code>.env</code>:</p>
<table>
<thead>
<tr><th>Variable</th><th>Default</th><th>Description</th></tr>
</thead>
<tbody>
<tr>
<td><span class="param-name">CI_ENVIRONMENT</span> <span class="badge req">required</span></td>
<td><code>production</code></td>
<td>Set to <code>development</code> locally for detailed error display.</td>
</tr>
<tr>
<td><span class="param-name">database.default.hostname</span> <span class="badge req">required</span></td>
<td>—</td>
<td>MySQL hostname. Use <code>127.0.0.1</code>.</td>
</tr>
<tr>
<td><span class="param-name">app.baseURL</span> <span class="badge req">required</span></td>
<td>—</td>
<td>Full URL with trailing slash. e.g. <code>http://localhost:8080/</code></td>
</tr>
<tr>
<td><span class="param-name">JWT_SECRET</span> <span class="badge opt">optional</span></td>
<td>—</td>
<td>Only needed if JWT API auth is enabled.</td>
</tr>
</tbody>
</table>
<div class="callout danger">
<span>🚫</span>
<div>
<strong>Never commit <code>.env</code></strong>
The file is in <code>.gitignore</code>. Use your CI/CD secrets manager for production values.
</div>
</div>