Developed upon Laravel 5.4 and Vue 2
- Nginx or Apache with
mod_rewrite
- PHP 7.0+
- PostgreSQL 9.5+
- Redis 3.0+
- Node.js 6.0+
Do either one of following:
- Change the owner of whole project directory to the user with which PHP-FPM or Apache runs. For example:
chown -R www:www .
chmod -R 777 storage bootstrap/cache
server {
...
root /home/wwwroot/cantonres.com/public;
location / {
...
try_files $uri $uri/ /index.php?$query_string;
}
}
You do not need to do anything since .htaccess
has done its duty.
- Copy
.env.example
to.env
- Run
php artisan key:generate
- Edit
.env
Make sure:
APP_DEBUG=false
APP_ENV=production
Run php artisan migrate
You must run php artisan migrate
each times you do a git pull
.
- Install Node.js 6.0+ (nvm is recommended) and yarn
- Install Front End dependencies with
yarn install
(or justyarn
) - Build JS and CSS with
yarn run production
You must run yarn run production
each times you do a git pull
.
- Use
UTF-8
for file encoding - Use
LF
for line breaking - Reserve an empty line at the end of file
- Respect PSR
- Indent with 4 spaces
- Do not indent empty lines
- Opening braces go on the same line
- Double quotes for strings
- Except to avoid escaping
- Keep semicolons for each statements
- Except for
export { ... }
orreturn { ... }
- Except for
- Use
let
to declare local variables rather thanvar
- Avoid declaring unused variables
- Each variable has its own declaration statement
- Keep space after keywords and commas
- Keep space before and after infix operators
- No space after function names
- Except for member function declarations in class/object
- Use ES2015 import/export syntax rather than
require()
function
Example:
import pangu from "pangu";
function hello(text) {
let str = text || "Hello世界!";
let length = str.length;
if (typeof str === "string")
str = pangu.spacing(str);
else
str = "Hello 世界!";
return { str, length }
}
class Greeter {
constructor (name) {
this.name = name;
if (name.length < 100) {
let mixin = {
html: "",
deny () {
return false;
}
};
let obj = {
...mixin,
html: '<div class="hello"></div>',
reverse: str => str.split("").reverse().join("")
};
} else {
console.log("The name is too long.");
}
}
greet () {
let str = "Hello " + this.name + "!";
window.alert(str);
return str;
}
}
export { hello as default, Greeter }
- Use
scss
rather thansass
- No prefixes. autoprefixer will add them automatically.
- Use
yarn
rather thannpm
(for lockfile support)
# Temporary Web Server
php -S localhost:9000 -t public server.php
# Webpack Hot Module Replacement
yarn run hot