laravel-blog

Laravel 5.8 blog application with Vue.js, Docker, Redis, Horizon, Telescope and Pusher

Github星跟蹤圖

Laravel 6.0 blog

Build Status
Donate

The purpose of this repository is to show good development practices on Laravel as well as to present cases of use of the framework's features like:

Beside Laravel, this project uses other tools like:

Some screenshots

You can find some screenshots of the application on : https://imgur.com/a/Jbnwj

Installation

Development environment requirements :

Setting up your development environment on your local machine :

$ git clone https://github.com/guillaumebriday/laravel-blog.git
$ cd laravel-blog
$ cp .env.example .env
$ docker-compose run --rm --no-deps blog-server composer install
$ docker-compose run --rm --no-deps blog-server php artisan key:generate
$ docker-compose run --rm --no-deps blog-server php artisan horizon:install
$ docker-compose run --rm --no-deps blog-server php artisan telescope:install
$ docker-compose run --rm --no-deps blog-server php artisan storage:link
$ docker run --rm -it -v $(pwd):/app -w /app node yarn
$ docker-compose up -d

Now you can access the application via http://localhost:8000.

There is no need to run php artisan serve. PHP is already running in a dedicated container.

Before starting

You need to run the migrations with the seeds :

$ docker-compose run --rm blog-server php artisan migrate --seed

This will create a new user that you can use to sign in :

email: darthvader@deathstar.ds
password: 4nak1n

And then, compile the assets :

$ docker run --rm -it -v $(pwd):/app -w /app node yarn dev

Starting job for newsletter :

$ docker-compose run blog-server php artisan tinker
> PrepareNewsletterSubscriptionEmail::dispatch();

Useful commands

Seeding the database :

$ docker-compose run --rm blog-server php artisan db:seed

Running tests :

$ docker-compose run --rm blog-server ./vendor/bin/phpunit --cache-result --order-by=defects --stop-on-defect

Running php-cs-fixer :

$ docker-compose run --rm --no-deps blog-server ./vendor/bin/php-cs-fixer fix --config=.php_cs --verbose --dry-run --diff

Generating backup :

$ docker-compose run --rm blog-server php artisan vendor:publish --provider="Spatie\Backup\BackupServiceProvider"
$ docker-compose run --rm blog-server php artisan backup:run

Generating fake data :

$ docker-compose run --rm blog-server php artisan db:seed --class=DevDatabaseSeeder

Discover package

$ docker-compose run --rm --no-deps blog-server php artisan package:discover

In development environnement, rebuild the database :

$ docker-compose run --rm blog-server php artisan migrate:fresh --seed

Accessing the API

Clients can access to the REST API. API requests require authentication via token. You can create a new token in your user profile.

Then, you can use this token either as url parameter or in Authorization header :

# Url parameter
GET http://laravel-blog.app/api/v1/posts?api_token=your_private_token_here

# Authorization Header
curl --header "Authorization: Bearer your_private_token_here" http://laravel-blog.app/api/v1/posts

API are prefixed by api and the API version number like so v1.

Do not forget to set the X-Requested-With header to XMLHttpRequest. Otherwise, Laravel won't recognize the call as an AJAX request.

To list all the available routes for API :

$ docker-compose run --rm --no-deps blog-server php artisan route:list --path=api

Contributing

Do not hesitate to contribute to the project by adapting or adding features ! Bug reports or pull requests are welcome.

License

This project is released under the MIT license.

主要指標

概覽
名稱與所有者guillaumebriday/laravel-blog
主編程語言PHP
編程語言PHP (語言數: 4)
平台
許可證MIT License
所有者活动
創建於2017-02-08 18:34:24
推送於2024-10-20 10:51:08
最后一次提交2024-10-20 12:51:06
發布數4
最新版本名稱2.1 (發布於 )
第一版名稱v1.0.0 (發布於 )
用户参与
星數1.8k
關注者數90
派生數598
提交數1.4k
已啟用問題?
問題數90
打開的問題數6
拉請求數46
打開的拉請求數0
關閉的拉請求數27
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?