为 Laravel 提供最低门槛的博客解决方案

v0.4.0 2021-10-06 00:14 UTC

This package is auto-updated.

Last update: 2024-09-06 08:31:59 UTC


README

动词。草率或粗心地书写。

开始写作吧。

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Scrawl 设计为 Laravel 基于文件的单用户博客解决方案,摩擦力最低

文档

要查看完整文档,请访问 Scrawl 主页

安装

您可以通过 composer 安装此包

composer require projektgopher/scrawl

您可以使用以下命令发布配置文件

php artisan vendor:publish --provider="Projektgopher\Scrawl\BlogServiceProvider" --tag="scrawl-config"

这是已发布配置文件的内容

return [

    /**
     * These folders are located in the resources directory. We suggest
     * storing them in a directory named md (markdown) to follow
     * with the conventions of the resources directory.
     */
    "unpublished_directory" => "md/scrawl/unpublished",
    "published_directory" => "md/scrawl/published",
    "blog_directory" => "md/scrawl",

    "author_bio" => "",
    "author_name" => "",
    "author_link" => "",
    "author_photo" => "",
    "author_photo_alt" => "",

    "route_group" => "blog",

    "view" => [
        /**
         * Read the list of driver options below, and
         * choose the option that best suits you.
         */
        "driver" => "standalone",

        /**
         * Use "none" if you'd like to return the data as JSON.
         * Particularly useful for Vue or React based blogs.
         */
        "none" => "",

        /**
         * Use "custom" if you don't have a main layout file
         * but also don't want to use the one provided.
         */
        "custom" => "",

        /**
         * Use "standalone" if you don't have a main layout
         * file. Great for just getting started quickly.
         * You can alawys move to a layout based
         * setup later on.
         */
        "standalone" => "",

        /**
         * Use "x-component" if your views include a blade
         * layout component such as <x-layouts.app />
         */
        "x-component" => [
            "component" => "layouts.app",
        ],

        /**
         * Use "blade-layout" if your views extend a
         * base layout using the @extends method.
         */
        "blade-layout" => [
            "extends" => "layouts.app",
            "section" => "body",
        ],
    ],

];

用法

Scrawl 旨在在 CLI 中使用。它将自动注册博客路由,且无需数据库,因为此包基于文件,旨在将内容提交到项目中。只有保存在 'published' 目录中的文章才是公开可访问的。

php artisan blog:make 'long title that should be sluggified'

此命令将确保存在未发布的目录,并将具有缩略标题的 .md 博客文章草稿复制到 'unpublished' 目录中。

现在您只需开始用 GitHub 风格的 Markdown 编写文章,无需担心所有细节。

php artisan blog:publish 'name of blog you would like to move to the published directory'
php artisan blog:unpublish 'name of the blog you should not have published yet'

测试

vendor/bin/phpunit --testdox

支持我们

我们投入了大量资源来创建 最佳开源包。您可以通过 购买我们的付费产品之一 来支持我们。

我们非常感谢您从家乡寄来明信片,提及您正在使用我们哪些包。您可以在 我们的联系页面 上找到我们的地址。我们将发布所有收到的明信片在 我们的虚拟明信片墙上

变更日志

请参阅 CHANGELOG 了解最近更改的详细信息。

贡献

请参阅 CONTRIBUTING 了解详细信息。

安全漏洞

请参阅 我们的安全策略 了解如何报告安全漏洞。

鸣谢

许可证

MIT 许可证(MIT)。请参阅 许可证文件 了解更多信息。