cnvs / canvas
A Laravel publishing platform
Fund package maintenance!
austintoddj
Installs: 39 933
Dependents: 2
Suggesters: 0
Security: 0
Stars: 2 380
Watchers: 80
Forks: 400
Open Issues: 29
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
Introduction
Canvas is a fully open source package to extend your existing Laravel application and get you up-and-running with a blog in just a few minutes. In addition to a distraction-free writing experience, you can view monthly trends on your content, get insights into reader traffic and more!
Requirements
- PHP >= 7.2
- Laravel >= 6.0
- One of the four supported databases by Laravel
Installation
Note: Canvas requires you to have user authentication in place prior to installation. Please see the official guide to get started.
You may use composer to install Canvas into your Laravel project:
composer require austintoddj/canvas
Publish the assets and primary configuration file using the canvas:install
Artisan command:
php artisan canvas:install
Create a symbolic link to ensure file uploads are publicly accessible from the web using the storage:link
Artisan command:
php artisan storage:link
Configuration
After publishing Canvas's assets, a primary configuration file will be located at config/canvas.php
. This file allows you to customize various aspects of how your application uses the package.
Canvas exposes its UI at /canvas
by default. This can be changed by updating the path
option:
/* |-------------------------------------------------------------------------- | 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'),
If your application has a custom User model, define the fully-qualified path in the user
option:
/* |-------------------------------------------------------------------------- | 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,
Sometimes, you may want to apply role or permission-based access to Canvas. You can create and attach any additional middleware here:
/* |-------------------------------------------------------------------------- | 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 uses the storage disk for media uploads. You may configure the different filesystem options here:
/* |-------------------------------------------------------------------------- | 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),
Available Options
Note: The following features are completely optional, you are not required to use them.
Frontend
While Canvas does not dictate a specific design for your frontend, it does provide a basic starting point using Bootstrap and Vue that will be helpful for many applications. The scaffolding is located in the austintoddj/studio
Composer package, which may be installed using Composer:
composer require austintoddj/studio
Once the austintoddj/studio
package has been installed, you may install the frontend scaffolding using the studio:install
Artisan command:
php artisan studio:install
After installing the austintoddj/studio
Composer package and generating the frontend scaffolding, your package.json
file will include the necessary dependencies to install and compile:
# Using NPM npm install npm run dev # Using Yarn yarn yarn dev
Unsplash
Want access to the entire Unsplash library? Set up a new application at https://unsplash.com/oauth/applications, grab your access key, and update 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'), ]
Weekly Digest
Want a weekly summary? Canvas allows users to receive a weekly summary of their authored content. Once your application is configured for sending mail, update 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), ]
Since the weekly digest runs on Laravel's Scheduler, you'll need to add the following cron entry to your server:
* * * * * cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1
Updates
Canvas loosely follows Semantic Versioning and increments versions as MAJOR.MINOR.PATCH
numbers
- A major or minor version can contain breaking changes, so follow the upgrade guide for a step-by-step breakdown
- Patch versions will remain backwards compatible, so you can safely update the package by following the steps below:
You may update your Canvas installation using composer:
composer update
Run any new migrations using the migrate
Artisan command:
php artisan migrate
Re-publish the assets using the canvas:publish
Artisan command:
php artisan canvas:publish
Contributing
Thank you for considering contributing to Canvas! You can use the contribution guide to assist you in setting up the package for development.
Testing
Run the tests with:
composer test
Translate
One of the goals for the team behind Canvas is to ensure proper localization across the app. If you come across any translation mistakes or issues and want to make a contribution, please create a pull request. If you don't see your native language included in the resources/lang
directory, feel free to add it.
License
Canvas is open-sourced software licensed under the MIT license.