For a simple local development environment, you will need:
- A supported version of PHP
php5-json
php5-curl
Then inside the project directory, run php -S localhost:8000 router.php
. Next, just navigate to localhost:8000 to view the site.
For a full web-server environment, which includes more redirect and permissions you may find useful, you will need:
- A supported version of PHP
php5-json
php5-curl
- The latest stable version of Nginx
Then, we need to configure Nginx. To start, open up a configuration file in Nano.
sudo nano /etc/nginx/sites-enabled/mvp.conf
Then, paste in required configuration in, modifying the root, include and error_log paths.
server {
listen 80;
server_name mvp.localtest.me;
root /path/to/mvp;
include /path/to/mvp/nginx.conf;
error_log /path/to/error.log;
}
You can test the configuration with Nginx.
sudo nginx -t
Now we just need to restart the service.
sudo service nginx restart
Finally, navigate to mvp.localtest.me
- Four space indentation
- Remove trailing whitespaces and add an empty line at the end of each file
- IE 9+ Compatibility
include
templates, notrequire
or_once
- Use full PHP tags, not short ones
- Don't close PHP tags on PHP only files
- Correctly format assignments for readability
<?php
include '_templates/sitewide.php';
$page['title'] = 'HTML Safe Title';
include '_templates/header.php';
$foo = bar($para, $param);
$second_foo = 42;
$third_foo = 'hey';
?>
- Include
alt
attribute for all images - Include
title
attribute for all links - Close all your tags properly
- Try to use classes instead of IDs unless things are absolutely unique
- One selector per line
- Care with fallbacks and browsers compatibilities
.class {
color: #fefe89;
font-size: 1.1em;
}
.second-class,
.third-class {
backgound-color: white;
}
git checkout -b feature_branch_name
git push -u origin feature_branch_name
git pull origin master
git checkout feature_branch_name
git merge master
TODO