承接 roelofjan-elsinga/aloia-cms 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

roelofjan-elsinga/aloia-cms

Composer 安装命令:

composer require roelofjan-elsinga/aloia-cms

包简介

A drop-in flat file CMS for Laravel.

README 文档

README

CI StyleCI Status Code Coverage Total Downloads Latest Stable Version License

This package contains a drop-in CMS that uses files to store its contents.

For the full documentation, go to the Aloia CMS Documentation website.

Installation

You can include this package through Composer using:

composer require roelofjan-elsinga/aloia-cms

and if you want to customize the folder structure, then publish the configuration through:

php artisan vendor:publish --provider="AloiaCms\\AloiaCmsServiceProvider"

Creating a custom content type

Creating a custom content type is very simple. All you have to do is create a class that extends AloiaCms\Models\Model, specify a $folder_path, and optionally add required fields to $required_fields. An example can be found below:

namespace App\Models;

use AloiaCms\Models\Model;

class PortfolioItem extends Model
{
    protected $folder = 'portfolio_items';

    protected $required_fields = [
        'name',
        'github_url',
        'description',
    ];
}

Once you have a class like this, you can interact with it like described under "Usage of models"

Built-in models

There are 4 built-in models which you can use without any additional set-up:

  • Page
  • Article
  • ContentBlock
  • MetaTag

Of course, you can add your own models as described at "Creating a custom content type".

Usage of models

In this example we're looking at one of the built-in content types: Article. You can use these same steps for all classes that extend from "AloiaCms\Models\Model".

To load all articles in the "articles" folder in the folder you specified in config('aloiacms.collection_path') you can use the following script:

use AloiaCms\Models\Article;

/**@var Article[]*/
$articles = Article::all();

You can use that to display your posts on a page. You can also load a single post, using:

$post_slug = 'this-post-is-amazing';

$article = Article::find($post_slug);

If you only want all published posts, you'll need to retrieve them like so:

$published_articles = Article::published();

To get the raw contents of each article (content + front matter), you can use:

$post_slug = 'this-post-is-amazing';

$articles = Article::find($post_slug)->rawContent();

And finally, to update your article, you can run:

use Carbon\Carbon;

$post_slug = 'this-post-is-amazing';

Article::find($post_slug)
    ->setExtension('md') // md is the default, but you can use html as well.
    ->setMatter([
        'description' => 'This post is about beautiful things',
        'is_published' => true,
        'is_scheduled' => false,
        // Either use post_date in setMatter() or setPostDate()
        'post_date' => date('Y-m-d')
    ])
    ->setPostDate(Carbon::now())
    ->setBody('# This is the content of an article')
    ->save();

Content blocks

You can manage small content blocks for your website through this package.

The content of the blocks are stored in a folder called "content_blocks" inside of the config('aloiacms.collections_path') folder.

You'll need to register the facade into your application, by placing the following line to your aliases in config/app.php:

'Block' => \AloiaCms\Facades\BlockFacade::class,

Now you can use the facade in your blade views by using:

{!! Block::get('content-file-name') !!}

This facade will look for a file in the folder you specified in config('aloiacms.collections_path'). The Facade will parse the contents of the file to HTML to be able to render it. If no file could be found, an empty string will be returned.

NOTE: You should not specify the extension of the filename you're passing to Block::get(). This will be parsed automatically.

Testing

You can run the included tests by running ./vendor/bin/phpunit in your terminal.

Contributing

If you'd like to contribute to the CMS directly, you can create PR's on this repository. If you'd like to contribute to the documentation, you can create PR's on the repository for the documentation.

roelofjan-elsinga/aloia-cms 适用场景与选型建议

roelofjan-elsinga/aloia-cms 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4.24k 次下载、GitHub Stars 达 186, 最近一次更新时间为 2020 年 02 月 19 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「file」 「cms」 「laravel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 roelofjan-elsinga/aloia-cms 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 roelofjan-elsinga/aloia-cms 我们能提供哪些服务?
定制开发 / 二次开发

基于 roelofjan-elsinga/aloia-cms 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 4.24k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 186
  • 点击次数: 9
  • 依赖项目数: 4
  • 推荐数: 0

GitHub 信息

  • Stars: 186
  • Watchers: 4
  • Forks: 19
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-02-19