GithubHelp home page GithubHelp logo

guoyu07 / ouzo-app Goto Github PK

View Code? Open in Web Editor NEW

This project forked from letsdrink/ouzo-app

0.0 0.0 0.0 133 KB

Ouzo framework application skeleton

ApacheConf 0.35% PHP 60.12% HTML 37.18% Batchfile 0.49% Shell 0.43% CSS 1.43%

ouzo-app's Introduction

Ouzo - 5 minutes tutorial

Build Status

How to use Ouzo step by step. It takes only 5 minutes to set up sample project and start experiencing Ouzo.

Set up project

Simply use composer (http://getcomposer.org):

composer.phar create-project letsdrink/ouzo-app:1.4.0 myproject

Where myproject is your project's name.

After downloading Ouzo and its dependencies you will be asked what database you want to use. Ouzo will prepare config files for you. Database configuration can be changed manually later if needed.

PHP Version

You need:

  • PHP 5.6 or later installed. Currently Ouzo is tested on 5.6, 7.0, and 7.1 environments.
  • Database driver, accordingly to the database your are using.

In order to get list of available drivers check http://www.php.net/manual/en/pdo.getavailabledrivers.php.

Configure HTTP Server

Ouzo apps can be run on Apache web server. It needs mod_rewrite enabled. Once you have previous step completed, change document root to myproject.

Ouzo Configuration

Ouzo configuration is located under config/prod/config.php.

What's important for now is that debug is turned on by default. Please, leave it like this for installation purposes, as you will be able to see detailed error messages in case something goes wrong.

Database Configuration

Configuration is automatically generated for database of your choice. The only thing you need to do is to create database and database user first.

For MySQL:

CREATE DATABASE myproject;
CREATE USER 'ouzo'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON myproject.* TO 'ouzo'@'localhost';

For PostgreSQL:

CREATE DATABASE myproject;
CREATE USER ouzo WITH PASSWORD 'password';
GRANT ALL PRIVILEGES ON DATABASE myproject to ouzo;

If you do not use composer, sample project has PostgreSQL by default. Database config can be found in Ouzo configuration file:

$config['db']['dbname'] = 'myproject';
$config['db']['user'] = 'ouzo';
$config['db']['pass'] = 'password';
$config['db']['driver'] = 'pgsql';
$config['db']['host'] = '127.0.0.1';
$config['db']['port'] = '5432';
$config['sql_dialect'] = '\\Ouzo\\Db\\Dialect\\PostgresDialect';

You need to provide database name, user name & password, driver, host, port and SQL dialect class. For now Ouzo supports:

  • PostgreSQL - \Ouzo\Db\Dialect\PostgresDialect
  • MySQL - \Ouzo\Db\Dialect\MySqlDialect
  • SQLite3 - \Ouzo\Db\Dialect\Sqlite3Dialect

Migrations

Your database is empty at the beginning. To demonstrate Ouzo capabilities we have created a sample database. Use db.sh script to apply migrations:

./db.sh db:migrate

To see full list of possible migrations related actions run:

./db.sh

Ouzo uses Ruckusing framework for migrations (https://github.com/ruckus/ruckusing-migrations).

Check out the app!

Open your favourite browser and go to http://localhost/myproject. Your first Ouzo project is now running! You can play around by adding, browsing and editing users.

Running tests

Test configuration can be found in config/test/config.php. You will need separate database for tests purposes only.

Set up for MySQL:

CREATE DATABASE myproject_test;
GRANT ALL PRIVILEGES ON myproject_test.* TO 'ouzo'@'localhost';

Set up for PostgreSQL:

CREATE DATABASE myproject_test;
GRANT ALL PRIVILEGES ON DATABASE myproject_test to ouzo;

Apply migrations:

environment=test ./db.sh db:migrate

Now run tests:

phpunit --bootstrap bootstrap_test.php test/

If all tests are passing, you're good to go!

More

Skeleton app explained: http://ouzo.readthedocs.org/en/latest/tutorials/project_structure_explained.html

Ouzo documentation: http://ouzo.readthedocs.org

ouzo-app's People

Contributors

andrzejo avatar bbankowski avatar danon avatar piotrooo avatar woru 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.