enimiste/prado-project-starter

A starter project for building web site

v3.2.0 2016-09-01 03:17 UTC

This package is auto-updated.

Last update: 2024-10-29 04:47:40 UTC


README

A Project skeleton to build PRADO Framework based web application.
Prado3 is a Component Framework for PHP 5 (Like ASP .NET dose for C#).

Join the chat at https://gitter.im/prado-project-starter/Lobby

Pre-requisites :

  • php : >=5.3.3
  • ext-ctype
  • ext-dom
  • ext-json
  • ext-pcre
  • ext-spl

Installation :

Firstly run this command :

$ cd path/to/web/server/www
$ composer create-project enimiste/prado-project-starter project_name

If all goes right open the new project in your favorite IDE. (ex: PhpStorm)

Setup the Database schema and data :

You can use many types of database as it is supported by PDO Driver.
In this section i will focus on two database types : Sqlite and Mysql.

  • Sqlite :
    • Prequisites :
      • Installing Sqlite3 from Sqlite3.
      • Enabling PHP Sqlite extension on php.ini file
    • The project is bundled with the database file located under protected/data/app.db.
    • This database is seeded with the needed data. So it is ready to use for next steps.
  • Mysql :
    You have two options : Mysql extension or Mysqli extension
    So you should be sure that the desired extension is enabled in php.ini file before using it.
    1. Open the protected/config.database.xml file.

    2. Comment the sqlite config :

      <database ConnectionString="sqlite:protected/data/app.db"/>
    3. Uncomment the Mysql config (mysql or mysqli) :

      <!-- <database ConnectionString="mysqli:host=localhost;dbname=test"
                       username="dbuser" password="dbpass" /> -->
      <!-- <database ConnectionString="mysql:host=localhost;dbname=test"
                           username="dbuser" password="dbpass" /> -->
    4. Create an empty database named as ;dbname= in the step 3.

    5. Update host, username and password with the correct ones.

    6. Open your Mysql console and run the following statements in order :

      • The content of protected/data/migrations directory files (*.sql)
      • The content of protected/data/seeds directory files (*.sql)

Parameters config :

Now its time to update our parameters config located in the file protected/config/parameters.xml. Ex :

  <parameter id="base_url" value="http://localhost/project_name/"/>

This parameter is used to build assets urls (css, javascripts, ...) via the function site_url($uri)

Test in browser :

Now you can test the project.

  1. Check if your web server under it the project is deployed is running.
  2. Check if your RDBS is running if you use one.
  3. Type the URL to your project in the browser. Ex : http://localhost/project_name.
  4. The web app will show you the default page of Frontoffice.
  5. To see the Backoffice, click on the link "Espace d'administration" (Backoffice space in frensh, sorry) :
    • A login page will show.

    • Type one of these credentials to access the web app as authenticated user :

    • And bingo you can manage : users, site settings

Documentation :

The project is divided in two parts :

  • FO : Front office
  • BO : Back office

So protected/pages, protected/pages and themes directories are splited into two sub directories : fo and bo.

The themes directory holde the css, js files needed to render the IHM of each side of you web app. Ex: themes\bo contains sb-admin css and js files used in backoffice IHM.

The theme used in the backoffice is the SB-admin. For the front office is not implemented for instance.

Helpers functions :

I added a bunch of helper functions to help developper access most used features of Prado easaly.
Ex:

app();
//Shortcut to Prado::getApplication();
user();
//shortcut to Prado::getApplication()->getUser();

And so on ... Lets now take a tour of these function :

Request/Response :

Security :

General use :

Localisation :

File System :

LICENSE :

MIT