Coder Social home page Coder Social logo

webappbuilder / laravel-blog Goto Github PK

View Code? Open in Web Editor NEW

This project forked from guillaumebriday/laravel-blog

0.0 2.0 0.0 1.51 MB

Laravel 5.5 blog example project with Vue.js, Docker, Redis and Socket.io

License: MIT License

PHP 78.77% Ruby 2.63% JavaScript 0.59% Vue 1.74% HTML 16.28%

laravel-blog's Introduction

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

Beside Laravel, this project uses other tools like :

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 run --rm -it -v $(pwd):/app -w /app node npm install
$ docker-compose up -d

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

Before starting

You need to run the migrations :

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

Seed the database :

$ docker-compose run --rm blog-server 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 :

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

Useful commands

Running tests :

$ docker-compose run --rm blog-server ./vendor/bin/phpunit

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 backup:run

Generating fake data :

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

Starting job for newsletter :

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

Discover package

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

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.

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

Broadcasting & WebSockets

Before using WebSockets, you need to set the BROADCAST_DRIVER in your .env file for Redis :

BROADCAST_DRIVER=redis

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.

laravel-blog's People

Contributors

guillaumebriday avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.