abr4xas / simple-blog
该软件包已被废弃,不再维护。没有建议的替代软件包。
这里是一段巧妙的描述
v9.2.1
2023-08-20 18:57 UTC
Requires
- php: ^8.1
- guzzlehttp/guzzle: ^7.7
- league/commonmark: ^2.4
- simonvomeyser/commonmark-ext-lazy-image: ^2.0
- spatie/laravel-enum: ^3.0
- spatie/laravel-package-tools: ^1.16
- torchlight/torchlight-commonmark: ^0.5.5
Requires (Dev)
- laravel/pint: ^1.11
- nunomaduro/collision: ^7.8
- nunomaduro/larastan: ^2.6
- orchestra/testbench: ^8.9
- pestphp/pest: ^2.15
- pestphp/pest-plugin-arch: ^2.0
- pestphp/pest-plugin-laravel: ^2.2
- phpstan/extension-installer: ^1.3
- phpstan/phpstan-deprecation-rules: ^1.1
- phpstan/phpstan-phpunit: ^1.3
- spatie/laravel-ray: ^1.32
README
安装
您可以通过composer安装此软件包
composer require abr4xas/simple-blog
您可以使用以下命令发布并运行迁移以及其他操作
php artisan vendor:publish --provider="Abr4xas\SimpleBlog\SimpleBlogServiceProvider" --tag="simple-blog-migrations" php artisan migrate
用法
此软件包使用多态关系将Items模型与您选择的模型关联起来,您需要做的只是将以下特质添加到您想要使用的模型中: Abr4xas\SimpleBlog\Traits\HasArticle
要创建一篇文章,您需要执行如下操作
$user->articles()->create([ 'title' => 'My first fake post', 'slug' => 'my-first-post', 'excerpt' => 'The excerpt of this fake post', 'body' => 'The body of this fake post', 'status' => ArticleStatus::PUBLISHED(), // ArticleStatus::DRAFT() 'file' => 'https://i.pinimg.com/originals/4f/e7/06/4fe7066d4f3aa7201e38484230fc32b3.jpg', ]);
语法高亮
此软件包使用: Torchlight CommonMark,因此,您需要一个API密钥才能使其工作。请参阅以下文档: https://torchlight.dev/docs/clients/commonmark-php
如果您想激活torchlight的可复制选项,请执行以下操作
编辑您的 config/torchlight.php
文件,在选项数组中包含以下内容
'copyable' => true,
接下来,确保在您的 app.js
文件中注册以下JavaScript片段,如下所示
import Alpine from "alpinejs"; window.Alpine = Alpine; Alpine.data("codeBlock", () => ({ showMessage: false, copyToClipboard() { text = document.querySelector(".torchlight-copy-target").textContent; navigator.clipboard.writeText(text); // show the "copied" message for 2 seconds this.showMessage = true; setTimeout(() => (this.showMessage = false), 2000); }, })); Alpine.start();
测试
composer test
变更日志
有关最近更改的更多信息,请参阅 CHANGELOG
贡献
有关详细信息,请参阅 CONTRIBUTING
致谢
许可证
MIT许可证(MIT)。有关更多信息,请参阅许可证文件