# Installation

## Install package

Add the package in your `composer.json` by executing the command.

```bash
composer require astrotomic/stancy
```

## Configure dependencies

### spatie/sheets

Stancy uses [spatie/sheets](https://github.com/spatie/sheets) as base - a sheet is the data file which is used to fill a page. By default sheets can be Markdown (with YAML frontmatter), JSON or YAML files. But you can define your own [content parsers](https://github.com/spatie/sheets#content-parser). To use sheets you have to [create a collection](https://github.com/spatie/sheets#creating-your-first-collection) which is a folder that contains your sheets. You can define as much collections as you want.

{% tabs %}
{% tab title="config/sheets.php" %}

```php
<?php

use Spatie\Sheets\ContentParsers\JsonParser;

return [
    'default_collection' => 'static',

    'collections' => [
        'static',
        'blog',
        'data' => [
            'content_parser' => JsonParser::class,
            'extension' => 'json',
        ],
    ],
];
```

{% endtab %}

{% tab title="config/filesystems.php" %}

```php
<?php

return [
    'disks' => [
        'static' => [
            'driver' => 'local',
            'root' => resource_path('content/static'),
        ],
        'blog' => [
            'driver' => 'local',
            'root' => resource_path('content/blog'),
        ],
        'data' => [
            'driver' => 'local',
            'root' => resource_path('content/data'),
        ],
    ],
];
```

{% endtab %}
{% endtabs %}

{% content-ref url="/pages/-Lr8S0atNW4N5-V-LTP1" %}
[Content](/stancy/basics/content.md)
{% endcontent-ref %}

### spatie/laravel-feeds

Stancy comes with feed (Atom & RSS) support which is provided by [spatie/laravel-feeds](https://github.com/spatie/laravel-feed). A feed is generated from a sheet collection. Below is an example feed configuration which uses the `\Astrotomic\Stancy\Contracts\FeedFactory`.

{% tabs %}
{% tab title="config/feed.php" %}

```php
<?php

use Astrotomic\Stancy\Contracts\FeedFactory;

return [
    'feeds' => [
        'blog' => [
            'items' => [FeedFactory::class.'@makeFromSheetCollectionName', 'blog'],
            'url' => 'feed/blog.atom',
            'title' => 'Stancy Blog Feed',
            'description' => 'This is the Stancy blog feed.',
            'language' => 'en-US',
            'view' => 'feed::atom',
            'type' => 'application/atom+xml',
        ],
    ],
];
```

{% endtab %}
{% endtabs %}

{% content-ref url="/pages/-Lr8S0ayyU7y-Px25\_Sy" %}
[Feed Atom/RSS](/stancy/advanced/feed.md)
{% endcontent-ref %}

### spatie/laravel-export

Stancy integrates [spatie/laravel-export](https://github.com/spatie/laravel-export) to generate static files. You can configure the exporter in the config file or use the `\Astrotomic\Stancy\Contracts\ExportFactory` to add your pages programmatically. We recommend to disable the `crawl` option in the `config/export.php` and use the export factory to add pages to your export list.

{% content-ref url="/pages/-Lr8S0b-1XJwWwwT75Lg" %}
[static export](/stancy/advanced/static-export.md)
{% endcontent-ref %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.astrotomic.info/stancy/installation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
