cnvs / canvas
Requires
- php: ^7.2
- ext-json: *
- doctrine/dbal: ^2.10
- laravel/framework: ^6.0|^7.0
Requires (Dev)
- mockery/mockery: ^1.2
- orchestra/testbench: ^4.0|^5.0
- phpunit/phpunit: ^8.4|^9.0
- dev-master
- v5.4.0
- v5.3.11
- v5.3.10
- v5.3.9
- v5.3.8
- v5.3.7
- v5.3.6
- v5.3.5
- v5.3.4
- v5.3.3
- v5.3.2
- v5.3.1
- v5.3.0
- v5.2.5
- v5.2.4
- v5.2.3
- v5.2.2
- v5.2.1
- v5.2.0
- v5.1.1
- v5.1.0
- v5.0.3
- v5.0.2
- v5.0.1
- v5.0.0
- v4.2.9
- v4.2.8
- v4.2.7
- v4.2.6
- v4.2.5
- v4.2.4
- v4.2.3
- v4.2.2
- v4.2.1
- v4.2.0
- v4.1.39
- v4.1.38
- v4.1.37
- v4.1.36
- v4.1.35
- v4.1.34
- v4.1.33
- v4.1.32
- v4.1.31
- v4.1.30
- v4.1.29
- v4.1.28
- v4.1.27
- v4.1.26
- v4.1.25
- v4.1.24
- v4.1.23
- v4.1.22
- v4.1.21
- v4.1.20
- v4.1.19
- v4.1.18
- v4.1.17
- v4.1.16
- v4.1.15
- v4.1.14
- v4.1.13
- v4.1.12
- v4.1.11
- v4.1.10
- v4.1.9
- v4.1.8
- v4.1.7
- v4.1.6
- v4.1.5
- v4.1.4
- v4.1.3
- v4.1.2
- v4.1.1
- v4.1.0
- v4.0.3
- v4.0.2
- v4.0.1
- v4.0.0
- v3.4.5
- v3.4.4
- v3.4.3
- v3.4.2
- v3.4.1
- v3.4.0
- v3.3.1
- v3.3.0
- v3.2.4
- v3.2.3
- v3.2.2
- v3.2.1
- v3.2.0
- v3.1.0
- v3.1.0-rc
- v3.0.4
- v3.0.3
- v3.0.2
- v3.0.1
- v3.0.0
- v2.2.0
- v2.1.17
- v2.1.16
- v2.1.15
- v2.1.14
- v2.1.13
- v2.1.12
- v2.1.11
- v2.1.10
- v2.1.9
- v2.1.8
- v2.1.7
- v2.1.6
- v2.1.5
- v2.1.4
- v2.1.3
- v2.1.2
- v2.1.1
- v2.1.0
- v2.0.5
- v2.0.4
- v2.0.3
- v2.0.2
- v2.0.1
- v2.0.0
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0
- dev-develop
- dev-hotfix/5.4.0
- dev-feature/feed
This package is auto-updated.
Last update: 2020-08-26 01:39:16 UTC
README
简介
Canvas 是一个完全开源的包,可以扩展您的现有 Laravel 应用程序,并让您在几分钟内就能搭建一个博客。除了无干扰的写作体验外,您还可以查看您的内容的月度趋势,深入了解读者流量等等!
要求
- PHP >= 7.2
- Laravel >= 6.0
- 由 Laravel 支持的四种数据库之一
安装
注意: Canvas 需要在安装之前设置用户身份验证。请参阅官方指南开始。
您可以使用 composer 将 Canvas 安装到您的 Laravel 项目中
composer require austintoddj/canvas
使用 canvas:install
Artisan 命令发布资产和主要配置文件
php artisan canvas:install
使用 storage:link
Artisan 命令创建符号链接,以确保文件上传可以从网络公开访问
php artisan storage:link
配置
在发布 Canvas 的资产后,主要配置文件将位于 config/canvas.php
。此文件允许您自定义应用程序使用此包的各种方面。
Canvas 默认在 /canvas
展示其 UI。这可以通过更新 path
选项来更改
/* |-------------------------------------------------------------------------- | Base Route |-------------------------------------------------------------------------- | | This is the URI path where Canvas will be accessible from. You are free | to change this path to anything you like. Note that the URI will not | affect the paths of its internal API that aren't exposed to users. | */ 'path' => env('CANVAS_PATH_NAME', 'canvas'),
如果您的应用程序有一个自定义的用户模型,请在 user
选项中定义完全限定的路径
/* |-------------------------------------------------------------------------- | User Model |-------------------------------------------------------------------------- | | Next, you may define a specific user model that your application will | use for authentication. This will define the relationships between | a user and their posts, tags, and topics that they author. | */ 'user' => Illuminate\Foundation\Auth\User::class,
有时,您可能希望将角色或权限基于的访问应用于 Canvas。您可以在其中创建和附加任何额外的中间件
/* |-------------------------------------------------------------------------- | Route Middleware |-------------------------------------------------------------------------- | | These middleware will be attached to every route in Canvas, giving you | the chance to add your own middleware to this list or change any of | the existing middleware. Or, you can simply stick with the list. | */ 'middleware' => [ 'web', 'auth', ],
Canvas 使用存储磁盘进行媒体上传。您可以在其中配置不同的文件系统选项
/* |-------------------------------------------------------------------------- | Storage |-------------------------------------------------------------------------- | | This is the storage disk Canvas will use to put file uploads. You may | use any of the disks defined in the config/filesystems.php file and | you may also change the maximum upload size from its 3MB default. | */ 'storage_disk' => env('CANVAS_STORAGE_DISK', 'local'), 'storage_path' => env('CANVAS_STORAGE_PATH', 'public/canvas'), 'upload_filesize' => env('CANVAS_UPLOAD_FILESIZE', 3145728),
可用选项
注意:以下功能完全是可选的,您不需要使用它们。
前端
虽然 Canvas 没有指定您的前端特定设计,但它确实提供了一个使用 Bootstrap 和 Vue 的基本起点,这将对许多应用程序很有帮助。脚手架位于 austintoddj/studio
Composer 包中,可以使用 Composer 安装
composer require austintoddj/studio
安装 austintoddj/studio
Composer 包后,您可以使用 studio:install
Artisan 命令安装前端脚手架
php artisan studio:install
安装 austintoddj/studio
Composer 包并生成前端脚手架后,您的 package.json
文件将包括安装和编译所需的必要依赖项
# Using NPM npm install npm run dev # Using Yarn yarn yarn dev
Unsplash
想要访问整个Unsplash库? 在https://unsplash.com/oauth/applications上设置新的应用程序,获取您的访问密钥,并更新config/canvas.php
/* |-------------------------------------------------------------------------- | Unsplash Integration |-------------------------------------------------------------------------- | | Visit https://unsplash.com/oauth/applications to create a new Unsplash | app. Use the confidential Access Key given to you to integrate with | the API. Note that demo apps are limited to 50 requests per hour. | */ 'unsplash' => [ 'access_key' => env('CANVAS_UNSPLASH_ACCESS_KEY'), ]
每周摘要
想要每周摘要吗? Canvas 允许用户接收其创作的内容的每周总结。一旦您的应用程序配置为发送邮件,请更新config/canvas.php
/* |-------------------------------------------------------------------------- | E-Mail Notifications |-------------------------------------------------------------------------- | | This option controls e-mail notifications that will be sent via the | default application mail driver. A default option is provided to | support the notification system as an opt-in feature. | | */ 'mail' => [ 'enabled' => env('CANVAS_MAIL_ENABLED', false), ]
由于每周摘要是在Laravel的调度器上运行的,您需要在服务器上添加以下cron条目
* * * * * cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1
更新
Canvas大致遵循语义化版本控制,并按MAJOR.MINOR.PATCH
数字递增版本
- 主版本或次版本可能包含破坏性变更,因此请遵循升级指南以获取逐步说明
- 补丁版本将保持向后兼容,因此您可以安全地按照以下步骤更新包
您可以使用composer更新您的Canvas安装
composer update
运行任何新的迁移使用migrate
Artisan命令
php artisan migrate
使用canvas:publish
Artisan命令重新发布资源
php artisan canvas:publish
贡献
感谢您考虑为Canvas做出贡献!您可以使用贡献指南来帮助您为开发设置包。
测试
使用以下命令运行测试
composer test
翻译
Canvas团队的目标之一是确保应用程序的正确本地化。如果您发现任何翻译错误或问题并希望做出贡献,请创建一个pull request。如果您在resources/lang
目录中没有看到您的母语,请随时添加它。
许可
Canvas是开源软件,许可协议为MIT许可证。