> ## Documentation Index
> Fetch the complete documentation index at: https://docs.firepitcms.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Installation

> Getting started with Firepit CMS

## Installation

\[1] Installing the package requires to add these fields to your composer.json:

```
"repositories": [
    {
        "type": "vcs",
        "url":  "git@github.com:WebBuildsNL/firepit-cms.git"
    },
    {
        "type": "composer",
        "url": "https://satis.ralphjsmit.com"
    }
]
```

\[2] Then require it:

```
"require": {
    "firepit/cms": "{VERSION}"
}
```

\[3] {VERSION} could be either a version number, or `dev-master` to always grab latest.

\[4] Run composer update (On windows you need to add `-–ignore-platform-reqs ext-pcntl`, because this extension is not available on windows)

\[5] Run `php artisan cms:install`

## Installation Development Environment

There are two approaches to set up the development environment:

### Option 1: Using Git Submodules (Recommended)

This approach allows you to maintain separate Git repositories while keeping them connected:

1. From your Laravel project root, initialize the submodule:

```bash theme={null}
git submodule add https://github.com/WebBuildsNL/firepit-cms.git packages/firepit-cms
```

2. Initialize and update the submodule:

```bash theme={null}
git submodule init
git submodule update
```

3. Add to composer.json:

```json theme={null}
{
    "require": {
        "firepit/cms": "*"
    },
    "repositories": [
        {
            "type": "path",
            "url": "./packages/firepit-cms",
            "options": {
                "symlink": true
            }
        },
        {
            "type": "composer",
            "url": "https://satis.ralphjsmit.com"
        }
    ]
}
```

4. Run `composer update`

5. Extend your user model from the Firepit User model:

```php theme={null}
<?php

namespace App\Models;

use Firepit\Cms\Models\User as FirePitUser;

class User extends FirePitUser
{
}
```

Working with the submodule:

* To update the submodule to latest: `git submodule update --remote`
* To commit changes in the submodule:

```bash theme={null}
cd packages/firepit-cms
git checkout master  # or your working branch
# Make your changes
git add .
git commit -m "Your commit message"
git push
```

* Don't forget to commit the submodule reference in your main project:

```bash theme={null}
cd ../..  # back to main project
git add packages/firepit-cms
git commit -m "Update firepit-cms submodule"
```

### Option 2: Simple Clone (For Quick Testing)

1. Run the following commands from Laravel project root:

```bash theme={null}
mkdir packages && cd packages
git clone https://github.com/WebBuildsNL/firepit-cms.git
```

2. Follow steps 3 and 4 from Option 1.

Note: This method doesn't maintain the connection between repositories. Use Option 1 (Git Submodules) for proper version control.

## Production

Initiate the submodule:
`git submodule set-url packages/firepit-cms git@github.com:WebBuildsNL/firepit-cms.git`

Deploy script:

```sh theme={null}
git pull origin main
git submodule update --init --recursive
composer install --no-interaction --prefer-dist --optimize-autoloader --no-dev
```
