PhpDev.App
guillaumebriday/laravel-blog

guillaumebriday/laravel-blog

Stars: 1631

Forks: 556

Pull Requests: 69

Issues: 79

Watchers: 90

Last Updated: 2023-09-10 21:05:18

Laravel 9.0 blog application with Hotwire, Homestead, Horizon, Telescope and Pusher

License: MIT License

Languages: PHP, JavaScript, Shell, Blade

Laravel 9.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

To create your development environment follow these instructions.

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
$ php artisan key:generate
$ php artisan horizon:install
$ php artisan telescope:install
$ php artisan storage:link

Before starting

You need to run the migrations with the seeds :

$ php artisan migrate --seed

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

email: [email protected]
password: 4nak1n

And then, compile the assets :

$ yarn dev # or yarn watch

Starting job for newsletter :

$ php artisan tinker
> PrepareNewsletterSubscriptionEmail::dispatch();

Useful commands

Seeding the database :

$ php artisan db:seed

Running tests :

$ php artisan test

Running Laravel Pint :

$ ./vendor/bin/pint --verbose --test

Generating backup :

$ php artisan vendor:publish --provider="Spatie\Backup\BackupServiceProvider"
$ php artisan backup:run

Generating fake data :

$ php artisan db:seed --class=DevDatabaseSeeder

Discover package

$ php artisan package:discover

In development environment, rebuild the database :

$ 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 :

$ 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.

RELEASES

See all