Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/origin/master' into ft-make-com…
Browse files Browse the repository at this point in the history
…mand
  • Loading branch information
Gummibeer committed Oct 19, 2019
2 parents e9928ee + 6372fae commit f2eeb8a
Show file tree
Hide file tree
Showing 47 changed files with 976 additions and 105 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
/.phpunit.result.cache
/build/
/phpunit.xml
/tests/export/
30 changes: 17 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
![Stancy](docs/.gitbook/assets/stancy_github_social.png)
![Stancy](docs/.gitbook/assets/banner.png)

[![TravisCI](https://img.shields.io/travis/Astrotomic/stancy/master?label=TravisCI&style=flat-square&cacheSeconds=600)](https://travis-ci.org/Astrotomic/stancy/branches)
[![TravisCI](https://img.shields.io/travis/Astrotomic/stancy/master?label=TravisCI&style=flat-square)](https://travis-ci.org/Astrotomic/stancy/branches)
[![StyleCI](https://styleci.io/repos/210212315/shield)](https://styleci.io/repos/210212315)
[![ScrutinizerCI](https://img.shields.io/scrutinizer/build/g/Astrotomic/stancy?label=ScrutinizerCI&style=flat-square&cacheSeconds=600)](https://scrutinizer-ci.com/g/Astrotomic/stancy)
[![Quality)](https://img.shields.io/scrutinizer/quality/g/Astrotomic/stancy?label=Quality&style=flat-square&cacheSeconds=600)](https://scrutinizer-ci.com/g/Astrotomic/stancy)
[![Coveralls](https://img.shields.io/coveralls/github/Astrotomic/stancy?label=Coverage&style=flat-square&cacheSeconds=600)](https://coveralls.io/github/Astrotomic/stancy)
[![Libraries.io](https://img.shields.io/librariesio/github/Astrotomic/stancy?label=Dependencies&style=flat-square&cacheSeconds=600)](https://libraries.io/packagist/astrotomic%2Fstancy)

[![PHP from Packagist](https://img.shields.io/packagist/php-v/astrotomic/stancy?label=PHP&style=flat-square&cacheSeconds=600)](https://packagist.org/packages/astrotomic/stancy)
[![MIT License](https://img.shields.io/github/license/Astrotomic/stancy.svg?label=License&color=blue&style=flat-square&cacheSeconds=600)](https://github.com/Astrotomic/stancy/blob/master/LICENSE.md)
[![Latest Version](http://img.shields.io/packagist/v/astrotomic/stancy.svg?label=Release&style=flat-square&cacheSeconds=600)](https://packagist.org/packages/astrotomic/stancy)
[![Total Downloads](https://img.shields.io/packagist/dt/astrotomic/stancy.svg?label=Downloads&style=flat-square&cacheSeconds=600)](https://packagist.org/packages/astrotomic/stancy)
[![ScrutinizerCI](https://img.shields.io/scrutinizer/build/g/Astrotomic/stancy?label=ScrutinizerCI&style=flat-square)](https://scrutinizer-ci.com/g/Astrotomic/stancy)
[![Quality)](https://img.shields.io/scrutinizer/quality/g/Astrotomic/stancy?label=Quality&style=flat-square)](https://scrutinizer-ci.com/g/Astrotomic/stancy)
[![Coveralls](https://img.shields.io/coveralls/github/Astrotomic/stancy?label=Coverage&style=flat-square)](https://coveralls.io/github/Astrotomic/stancy)
[![Libraries.io](https://img.shields.io/librariesio/github/Astrotomic/stancy?label=Dependencies&style=flat-square)](https://libraries.io/packagist/astrotomic%2Fstancy)

[![PHP from Packagist](https://img.shields.io/packagist/php-v/astrotomic/stancy?label=PHP&style=flat-square)](https://packagist.org/packages/astrotomic/stancy)
[![MIT License](https://img.shields.io/github/license/Astrotomic/stancy.svg?label=License&color=blue&style=flat-square)](https://github.com/Astrotomic/stancy/blob/master/LICENSE.md)
[![Latest Version](http://img.shields.io/packagist/v/astrotomic/stancy.svg?label=Release&style=flat-square)](https://packagist.org/packages/astrotomic/stancy)
[![Total Downloads](https://img.shields.io/packagist/dt/astrotomic/stancy.svg?label=Downloads&style=flat-square)](https://packagist.org/packages/astrotomic/stancy)
[![GitHub contributors](https://img.shields.io/github/contributors/Astrotomic/stancy?label=Contributors&style=flat-square)](https://github.com/Astrotomic/stancy/graphs/contributors)
[![Open Collective](https://img.shields.io/opencollective/all/astrotomic?label=Backers&style=flat-square&cacheSeconds=600)](https://opencollective.com/astrotomic)
[![GitBook](https://img.shields.io/badge/GitBook-Stancy-E91E63.svg?style=flat-square&cacheSeconds=600)](https://docs.astrotomic.info/stancy)
[![Open Collective](https://img.shields.io/opencollective/all/astrotomic?label=Backers&style=flat-square)](https://opencollective.com/astrotomic)
[![GitBook](https://img.shields.io/badge/GitBook-Stancy-E91E63.svg?style=flat-square)](https://docs.astrotomic.info/stancy)

**You search for a CMS that only extends your loved Laravel/Lumen framework? Here it is.**

This package aims to provide the most common (and flexible) CMS features to your Laravel/Lumen project. You can still use the frontend/template engine of your choice, use the scheduler/queue and receive POST requests.

## Installation

Expand Down
10 changes: 5 additions & 5 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
## Supported Versions

This package has no LTS releases - this means that we will only support the latest minor release with feature updates.
Because we never had any security vulnerabilities until now we don't promise any list of versions.
Instead we will decide this from case to case - depending on factors like:
We have never had any security vulnerabilities and therefore we don't promise any list of versions.
Instead we will determine this on a case by case basis - depending on factors like:
* vulnerable versions
* age of the versions
* usage of the versions (packagist downloads)
* effort needed to fix it in the versions

At all we will do our best to fix security issues and inform all users about possible issues.
We will do our best to fix security issues as and when they become apparent. We will attempt inform all users about possible issues.

## Reporting a Vulnerability

Because security vulnerabilities could harm users we please you to don't use the public issue tracker to report them.
Due to the fact that security vulnerabilities could harm users, we ask that you don't use the public issue tracker to report them.
Please write a mail to [dev.gummibeer@gmail.com](mailto:dev.gummibeer@gmail.com).
Depending on the kind of issue we will create a public issue/security alert or fix it and inform afterwards.
We will either create a public issue/security alert, or we will fix the vulnerability and inform users afterwards.
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@
"Astrotomic\\Stancy\\StancyServiceProvider"
],
"aliases": {
"ExportFactory": "Astrotomic\\Stancy\\Facades\\ExportFactory",
"FeedFactory": "Astrotomic\\Stancy\\Facades\\FeedFactory",
"SitemapFactory": "Astrotomic\\Stancy\\Facades\\SitemapFactory",
"PageFactory": "Astrotomic\\Stancy\\Facades\\PageFactory"
"PageFactory": "Astrotomic\\Stancy\\Facades\\PageFactory",
"SitemapFactory": "Astrotomic\\Stancy\\Facades\\SitemapFactory"
}
}
},
Expand Down
5 changes: 0 additions & 5 deletions config/stancy.php

This file was deleted.

Binary file added docs/.gitbook/assets/banner (1).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/.gitbook/assets/banner (2).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/.gitbook/assets/banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/.gitbook/assets/stancy_github_social (1).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 8 additions & 13 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
# Introduction

![Stancy](.gitbook/assets/stancy_github_social.png)
![Stancy](.gitbook/assets/banner%20%282%29.png)

[![TravisCI](https://img.shields.io/travis/Astrotomic/stancy/master?label=TravisCI&style=flat-square&cacheSeconds=600)](https://travis-ci.org/Astrotomic/stancy/branches)
[![StyleCI](https://styleci.io/repos/210212315/shield)](https://styleci.io/repos/210212315)
[![ScrutinizerCI](https://img.shields.io/scrutinizer/build/g/Astrotomic/stancy?label=ScrutinizerCI&style=flat-square&cacheSeconds=600)](https://scrutinizer-ci.com/g/Astrotomic/stancy)
[![Quality)](https://img.shields.io/scrutinizer/quality/g/Astrotomic/stancy?label=Quality&style=flat-square&cacheSeconds=600)](https://scrutinizer-ci.com/g/Astrotomic/stancy)
[![Coveralls](https://img.shields.io/coveralls/github/Astrotomic/stancy?label=Coverage&style=flat-square&cacheSeconds=600)](https://coveralls.io/github/Astrotomic/stancy)
[![Libraries.io](https://img.shields.io/librariesio/github/Astrotomic/stancy?label=Dependencies&style=flat-square&cacheSeconds=600)](https://libraries.io/packagist/astrotomic%2Fstancy)
[![TravisCI](https://img.shields.io/travis/Astrotomic/stancy/master?label=TravisCI&style=flat-square)](https://travis-ci.org/Astrotomic/stancy/branches) [![StyleCI](https://styleci.io/repos/210212315/shield)](https://styleci.io/repos/210212315) [![ScrutinizerCI](https://img.shields.io/scrutinizer/build/g/Astrotomic/stancy?label=ScrutinizerCI&style=flat-square)](https://scrutinizer-ci.com/g/Astrotomic/stancy) [![Quality\)](https://img.shields.io/scrutinizer/quality/g/Astrotomic/stancy?label=Quality&style=flat-square)](https://scrutinizer-ci.com/g/Astrotomic/stancy) [![Coveralls](https://img.shields.io/coveralls/github/Astrotomic/stancy?label=Coverage&style=flat-square)](https://coveralls.io/github/Astrotomic/stancy) [![Libraries.io](https://img.shields.io/librariesio/github/Astrotomic/stancy?label=Dependencies&style=flat-square)](https://libraries.io/packagist/astrotomic%2Fstancy)

[![PHP from Packagist](https://img.shields.io/packagist/php-v/astrotomic/stancy?label=PHP&style=flat-square)](https://packagist.org/packages/astrotomic/stancy) [![MIT License](https://img.shields.io/github/license/Astrotomic/stancy.svg?label=License&color=blue&style=flat-square)](https://github.com/Astrotomic/stancy/blob/master/LICENSE.md) [![Latest Version](http://img.shields.io/packagist/v/astrotomic/stancy.svg?label=Release&style=flat-square)](https://packagist.org/packages/astrotomic/stancy) [![Total Downloads](https://img.shields.io/packagist/dt/astrotomic/stancy.svg?label=Downloads&style=flat-square)](https://packagist.org/packages/astrotomic/stancy) [![GitHub contributors](https://img.shields.io/github/contributors/Astrotomic/stancy?label=Contributors&style=flat-square)](https://github.com/Astrotomic/stancy/graphs/contributors) [![Open Collective](https://img.shields.io/opencollective/all/astrotomic?label=Backers&style=flat-square)](https://opencollective.com/astrotomic)

**You search for a CMS that only extends your loved Laravel/Lumen framework? Here it is.**

This package aims to provide the most common \(and flexible\) CMS features to your Laravel/Lumen project. You can still use the frontend/template engine of your choice, use the scheduler/queue and receive POST requests.

[![PHP from Packagist](https://img.shields.io/packagist/php-v/astrotomic/stancy?label=PHP&style=flat-square&cacheSeconds=600)](https://packagist.org/packages/astrotomic/stancy)
[![MIT License](https://img.shields.io/github/license/Astrotomic/stancy.svg?label=License&color=blue&style=flat-square&cacheSeconds=600)](https://github.com/Astrotomic/stancy/blob/master/LICENSE.md)
[![Latest Version](http://img.shields.io/packagist/v/astrotomic/stancy.svg?label=Release&style=flat-square&cacheSeconds=600)](https://packagist.org/packages/astrotomic/stancy)
[![Total Downloads](https://img.shields.io/packagist/dt/astrotomic/stancy.svg?label=Downloads&style=flat-square&cacheSeconds=600)](https://packagist.org/packages/astrotomic/stancy)
[![GitHub contributors](https://img.shields.io/github/contributors/Astrotomic/stancy?label=Contributors&style=flat-square)](https://github.com/Astrotomic/stancy/graphs/contributors)
[![Open Collective](https://img.shields.io/opencollective/all/astrotomic?label=Backers&style=flat-square&cacheSeconds=600)](https://opencollective.com/astrotomic)
23 changes: 23 additions & 0 deletions docs/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,26 @@
* [Changelog](changelog.md)
* [Installation](installation.md)

## Basics

* [Content](basics/content.md)
* [PageData](basics/pagedata.md)
* [🚧 Make Command](basics/make-command.md)

## Advanced

* [Feed Atom/RSS](advanced/feed.md)
* [Sitemap](advanced/sitemap.md)
* [static export](advanced/static-export.md)

## Webserver

* [🚧 nginx](webserver/nginx.md)
* [🚧 caddy](webserver/caddy.md)

## Services

* [🚧 netlify](services/netlify.md)
* [🚧 sitesauce](services/sitesauce.md)
* [🚧 forestry](services/forestry.md)

40 changes: 40 additions & 0 deletions docs/advanced/feed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Feed Atom/RSS

Stancy can generate feeds using [spatie/laravel-feed](https://github.com/spatie/laravel-feed). It allows you to generate a feed for a whole page collection.

## Feed configuration

The package provides a feed factory which enables you to generate your feed by passing the page collection name.

{% code-tabs %}
{% code-tabs-item 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',
],
],
];
```
{% endcode-tabs-item %}
{% endcode-tabs %}

## Feed links

You can generate alternate link tags for all your configured feeds and include them in your blade view.

```text
@include('feed::links')
```

52 changes: 52 additions & 0 deletions docs/advanced/sitemap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Sitemap

Stancy can generate a sitemap using [spatie/laravel-sitemap](https://github.com/spatie/laravel-sitemap). It allows you to add whole collections but also single pages to a sitemap.

## prepare Pages

By default you can't add a page to your sitemap. You have to use a `\Astrotomic\Stancy\Models\PageData` class which defines the `toSitemapItem()` method. The easiest way is to use the `\Astrotomic\Stancy\Contracts\Routable` interface and `\Astrotomic\Stancy\Traits\PageHasUrl` trait. After this you only have to define the `getUrl()` method which is also useful to add the page to a [feed](feed.md) or generate a link to it in a view.

{% code-tabs %}
{% code-tabs-item title="app/Pages/Post.php" %}
```php
<?php

namespace App\Pages;

use Astrotomic\Stancy\Contracts\Routable;
use Astrotomic\Stancy\Models\PageData;
use Astrotomic\Stancy\Traits\PageHasContent;
use Astrotomic\Stancy\Traits\PageHasSlug;
use Astrotomic\Stancy\Traits\PageHasUrl;

class Post extends PageData implements Routable
{
use PageHasSlug, PageHasContent, PageHasUrl;

public function getUrl(): string
{
return route('blog.post', ['post' => $this->slug]);
}
}
```
{% endcode-tabs-item %}
{% endcode-tabs %}

## Sitemap response

The following code snippet will show you how to return a sitemap within your routes. The sitemap will contain all pages in the `static` and `blog` collection.

{% code-tabs %}
{% code-tabs-item title="routes/web.php" %}
```php
<?php

use Astrotomic\Stancy\Facades\SitemapFactory;

Route::get('/sitemap.xml', function () {
return SitemapFactory::makeFromSheetList(['static', 'blog']);
});
```
{% endcode-tabs-item %}
{% endcode-tabs %}

83 changes: 83 additions & 0 deletions docs/advanced/static-export.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# static export

Stancy integrates [spatie/laravel-export](https://github.com/spatie/laravel-export) to export your pages as static files.

## Configuration

We recommend to disable the `crawl` option and export only listed paths/pages. The `paths` option can be empty if you only want to export feeds and/or pages. But you also can add additional paths, like the sitemap, to export.

{% code-tabs %}
{% code-tabs-item title="config/export.php" %}
```php
<?php

return [
// to only export listed paths/pages
'crawl' => false,

'paths' => [
'/sitemap.xml',
],
];
```
{% endcode-tabs-item %}
{% endcode-tabs %}

## prepare Pages

By default you can't export any page, only the feeds. To allow page export you have to implement the `\Astrotomic\Stancy\Contracts\Routable` interface in your [page data class](../basics/pagedata.md). This interface is also good to add your pages to a [sitemap](sitemap.md) and [feeds](feed.md).

{% code-tabs %}
{% code-tabs-item title="app/Pages/Home.php" %}
```php
<?php

namespace App\Pages;

use Astrotomic\Stancy\Contracts\Routable;
use Astrotomic\Stancy\Models\PageData;

class Home extends PageData implements Routable
{
public function getUrl(): string
{
return url('/');
}
}
```
{% endcode-tabs-item %}
{% endcode-tabs %}

## ExportFactory

To add your pages programmatically you should use a service provider. This service provider should be the last or at least after `\App\Providers\RouteServiceProvider` in your `app.providers` configuration. In the service provider you should use the `boot()` method where you can inject the `\Astrotomic\Stancy\Contracts\ExportFactory` service and add a new `booted` event listener.

{% code-tabs %}
{% code-tabs-item title="app/Providers/ExportServiceProvider.php" %}
```php
<?php

namespace App\Providers;

use Astrotomic\Stancy\Contracts\ExportFactory as ExportFactoryContract;
use Illuminate\Support\ServiceProvider;

class ExportServiceProvider extends ServiceProvider
{
public function boot(ExportFactoryContract $exportFactory)
{
$this->app->booted(function () use ($exportFactory) {
$exportFactory
->addFeeds()
->addSheetList(['static:home', 'static:blog'])
->addSheetCollectionName('blog')
;
});
}
}
```
{% endcode-tabs-item %}
{% endcode-tabs %}

This service provider will add all [feeds](feed.md), blog posts and the `home` and `blog` static pages.

Loading

0 comments on commit f2eeb8a

Please sign in to comment.