Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
PHP JavaScript
branch: master

This branch is 5 commits behind wlab:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
nano/core
plugins
project
sql
web
.gitignore
LICENCE
README
cli

README

888b    888        d8888 888b    888  .d88888b.  8888888b.  888    888 8888888b.       888     888  .d8888b.  
8888b   888       d88888 8888b   888 d88P" "Y88b 888   Y88b 888    888 888   Y88b      888     888 d88P  Y88b 
88888b  888      d88P888 88888b  888 888     888 888    888 888    888 888    888      888     888        888 
888Y88b 888     d88P 888 888Y88b 888 888     888 888   d88P 8888888888 888   d88P      Y88b   d88P      .d88P 
888 Y88b888    d88P  888 888 Y88b888 888     888 8888888P"  888    888 8888888P"        Y88b d88P   .od888P"  
888  Y88888   d88P   888 888  Y88888 888     888 888        888    888 888               Y88o88P   d88P"      
888   Y8888  d8888888888 888   Y8888 Y88b. .d88P 888        888    888 888                Y888P    888"       
888    Y888 d88P     888 888    Y888  "Y88888P"  888        888    888 888                 Y8P     888888888  

Quick Introduction :-

NanoPHP has been designed for rapid development of PHP based projects. It utilises most of the new features 5.3.2+ has to offer.

Requirements :-

MySQL 5.1 +

Apache 2
	- mod_rewrite enabled
	- mod_headers enabled (optional)

PHP 5.3.2 +
	- MySqli Extension (PHP 5 Mysql)
	- xdebug (optional - recommended)
	- memcached (optional - recommended)

Installation :-

1.) Run the SQL code in sql/nanophp_structure.sql

2.) Edit site/config/environments/Dev.class.php
	
----------------------------------------------------------------------------------------------------------------------------

'databases' => array (
	'default' => array(
		'mode' => \site\core\db\core\Database::DB_MODE_SINGLE, //.only mode currently supported
		'name' => 'nanophp', //.database name
		'servers' => array(
			array(
				'host' => 'localhost', //.database hostname/ip
				'port' => '3306', //.database port
				'user' => 'root', //.database username
				'pass' => 'test' //.database password
			)
		)
	)
),

----------------------------------------------------------------------------------------------------------------------------

3.) Check your details are correct to access the MySQL database.

4.) In web/.htaccess towards the bottom there should be two access rules:

----------------------------------------------------------------------------------------------------------------------------

# ####### Dev ##########
RewriteCond %{HTTP_HOST} ^www\.example\.dev$
RewriteRule	.* index.php [L,E=PROJECT_APP:front_end,E=PROJECT_ENV:Dev]
# #######################

# ####### Dev ##########
RewriteCond %{HTTP_HOST} ^admin\.example\.dev$
RewriteRule	.* index.php [L,E=PROJECT_APP:back_end,E=PROJECT_ENV:Dev]
# #######################

----------------------------------------------------------------------------------------------------------------------------

This tells NanoPHP, that when accessing 'www.example.dev', load the 'front_end' project and use the environment 'Dev'

To access this project, a new rule will have to be added to your Apache Virtual Hosts (/etc/apache2):

----------------------------------------------------------------------------------------------------------------------------

<VirtualHost *:80>
        ServerName example.dev
        ServerAlias *.example.dev
        DocumentRoot /var/www/servers/nanophp-v2

        RewriteEngine On
</VirtualHost>

----------------------------------------------------------------------------------------------------------------------------

In it's most basic form, the Virtual Host Rule should look something like the above. (Remember to restart Apache - /etc/init.d/apache2 restart)

5.) Now generate your first project by running:

~> ./cli generate:NewProject

Type 'front_end'. This will create a project called 'front_end' in site/projects

6.) You can update your database models by running:

~> ./cli generate:DatabaseModels --environment=Dev --connection=default --database=nanophp

7.) Visit www.example.dev (you may need to add this to your hosts file) and you should see everything is ok and running.

8.) A basic version of the Admin panel will be available at admin.example.dev (username: chris@nanophp.org, password: testing).
Something went wrong with that request. Please try again.