Skip to content

JaimeVazquezC/laravel-blog

 
 

Repository files navigation

Build Status

Laravel 5.4 blog

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 functionalities like :

Installation

Development environment requirements :

Setting up your development environment on your local machine with Homestead :

$ git clone https://github.com/guillaumebriday/laravel-blog.git
$ cd laravel-blog
$ cp .env.dev .env
$ composer install
$ vagrant up

Now you can access the site via http://192.168.10.10 or http://laravel-blog.app if you added the domain to your hosts file.

Before starting

The following commands must be executed on the virtual machine :

$ vagrant ssh
$ cd /home/vagrant/laravel-blog

You need to run the migrations :

$ php artisan migrate

Seed the database :

$ php artisan db:seed

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

Email : [email protected]
Password : 4nak1n

And then, compile the assets :

$ npm install
$ npm run dev

Useful commands

The following commands must be executed on the virtual machine in the folder /home/vagrant/laravel-blog.

Running tests :

$ ./vendor/bin/phpunit

Running php-cs-fixer :

$ ./vendor/bin/php-cs-fixer fix --config=.php_cs --verbose --dry-run --diff

Generating fake data :

$ php artisan db:seed --class=DevDatabaseSeeder

Running the queue worker :

$ php artisan queue:work

Starting job for newsletter :

$ php artisan tinker
> dispatch(new App\Jobs\PrepareNewsletterSubscriptionEmail());

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

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.

More details

More details are available or to come on Guillaume Briday's blog (French).

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.

About

Laravel 5.4 blog example project with good practices

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 83.6%
  • HTML 15.8%
  • Other 0.6%