Code Monkey home page Code Monkey logo

system's Introduction

Aura System

Build Status

The Aura System provides a full-stack Aura framework built around Aura library packages.

Getting Started

Installation

Install via Composer to a {$PROJECT_PATH} of your choosing:

composer create-project aura/system {$PROJECT_PATH}

This will create the system skeleton and install all of the necessary packages.

Once you have installed the Aura system, start the built-in PHP server with an Aura.Framework command:

cd {$PROJECT_PATH}
php package/Aura.Framework/cli/server

You can then open a browser and go to http://0.0.0.0:8000 to see the "Hello World!" demo output.

Press Ctrl-C to stop the built-in PHP server.

Additionally, you can run a command-line test:

cd {$PROJECT_PATH}
php package/Aura.Framework_Demo/cli/hello

You should see "Hello World!" as the output.

Run The Tests

For testing, you need to have PHPUnit 3.7 or later installed.

To run the integration tests for the system as a whole, change to the tests directory and issue phpunit:

cd {$PROJECT_PATH}/tests
phpunit

To run the unit tests for a package, change to that package's tests directory and issue phpunit:

cd {$PROJECT_PATH}/package/Aura.Autoload/tests
phpunit

Web Server

To run Aura under Apache or another web server, add a virtual host to your web server configuration, then point its document root to {$PROJECT_PATH}/web.

If mod_rewrite or an equivalent module is installed on the server, you will be able to browse without needing index.php in the URL.

Remove the Demo Package

When you are satisifed that the installation is working, edit the composer.json file to remove the aura/framework-demo package requirement and then run composer update.

System Organization

The system directory structure is pretty straightforward:

{$PROJECT_PATH}/
    config/                     # mode-specific config files
        _mode                   # the config mode to use
        _packages               # load these packages in order
        default.php             # default config
        dev.php                 # shared development server config
        local.php               # local development server config
        prod.php                # production config
        stage.php               # staging config
        test.php                # testing config
    include/                    # application include-path directory
    package/                    # aura-package libraries
    tests/                      # system tests
    tmp/                        # temporary files
    vendor/                     # composer vendors
    web/                        # web server document root
        .htaccess               # mod_rewrite rules
        cache/                  # public cached files
        favicon.ico             # favicon to reduce error_log lines
        index.php               # bootstrap script

Writing A Page Controller

Let's create a package and a page controller, and wire it up for browsing. We will do so in a project-specific way, leaving out the complexities of creating an independent package for distribution.

Warning: If you have not removed the Framework_Demo package yet, please do so before continuing. Otherwise, your routes will not work correctly.

Create The Controller

Change to the include/ directory and create a location for the example package and a space for our first web page ...

cd {$PROJECT_PATH}/include
mkdir -p Example/Package/Web/Home
cd Example/Package/Web/Home

... then create a file called HomePage.php. Add this code for a bare-bones index action:

<?php
namespace Example\Package\Web\Home;

use Aura\Framework\Web\Controller\AbstractPage;

class HomePage extends AbstractPage
{
    public function actionIndex()
    {
        $this->view = 'index';
    }
}
?>

Create The View

Next, create a view for the index action in a file called views/index.php and add the following code to it

<?php echo "This is an example home page."; ?>

At this point your include/ directory should look like this:

include/
    Example
        Package/
            Web/
                Home/
                    HomePage.php
                    views/
                        index.php

N.b.: Technically you don't need a directory structure this deep. However, a structure like this makes it easy to add new pages as well as other support libraries without having to change the project organization later.

Configure The System

Now we need to wire up the page controller to the autoloader and the routing system. Change to the system config directory:

$ cd {$PROJECT_PATH}/config

Edit the default.php file and add this code at the end of the file:

<?php
// attach the path for a route named 'home' to the controller and action
$di->params['Aura\Router\Map']['attach'][''] = [
    // all routes with the '' path prefix (i.e., no prefix)
    'routes' => [
        // a route named 'home'
        'home' => [
            'path' => '/',
            'values' => [
                'controller' => 'home',
                'action'     => 'index',
            ],
        ],
    ]
];

// map the 'home' controller value to the controller class
$di->params['Aura\Framework\Web\Controller\Factory']['map']['home'] = 'Example\Package\Web\Home\HomePage';
?>

Try It Out

You should now be able to browse to the / URL to see "This is an example home page."

system's People

Contributors

amystephen avatar arisk avatar galactic-void avatar green-cat avatar harikt avatar pborreli avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

system's Issues

Refactor

Refactoring may increase speed ? Not sure :) .

Functions
Currently
public function dashesToCamel($str)
{
$str = ucwords(str_replace('-', ' ', $str));
$str = str_replace(' ', '', $str);
return lcfirst($str);
}

public function dashesToCamel($str)
{
    $str = ucwords(str_replace(array('-',' '), '', $str));
    return lcfirst($str);
}

public function underToCamel 

Currently
$str = ucwords(str_replace('_', ' ', $str));
$str = str_replace(' ', '', $str);

Can't we use
$str = ucwords(str_replace(array('_', ' ') , '', $str));

Is there any benifict over the other ?

GitHub Service Hook for Packagist

This package is not auto-updated. Go and set up the GitHub Service Hook for Packagist so that it gets updated whenever you push!

Please make the necessary changes in the admin of all repo .

Thanks

Hari

This project not work

This is a result of command composer create-project aura/system my-project

Schermata del 2019-06-20 15-35-25

In any case, it uses too many dependencies (psr and monolog but unfortunately I noticed zend dependencies too)

Too bad ... it could be nice to do something simple.

Travis-ci Hook

Hey Paul ,

Please add the travis-ci hooks to all repos, so it can notify if a test fails before merge .

In this way even if the user doesn't run a test we can make sure everything works as expected.

Remove composer.phar

Hi Paul,

I don't like the idea of we keeping the composer.phar , for at times if I only need the system for I have composer.phar . Its waste of my bandwidth .

So I love you to remove composer.phar from the system .

We will document where to download etc , but not composer.phar itself .

Also the composer.phar needs to be updated which can be done by composer.phar self-update . If so we want to document also about composer. So let the user download it .

Comments

We need a way to comment the packages .

#Aura.View 
;Aura.View

Something like this for config/_packages

Thanks

No package directory

Just cloned the system and then ran the update php script. Update tries to put the packages into a package folder which doesn't exist.

Aura.Uri

Hi Paul ,

The Aura.Uri cannot create issues currently .

The Aura.Uri is showing its a fork currently. Can we change the one in .git/config to make Aura.Uri as the main one ? I guess its possible. Not possible .

print_r , var_dump issues

Hi Guys,

Someone was mentioning to me, the problem he didn't like working with Aura framework is when a print_r() is given it throws the whole reflection classes , and make the browser not responding. So I suggest we need to make a good debugger tool to fix this issue.

Never Submit System to Packagist

Though we have composer.json for system. Don't submit system to packagist .

If we submit people will try to download system like

{
    "minimum-stability": "dev",
    "require": {
        "hari/aura-system": "dev-master"
    }
}

So in this case it will download to vendor only of the composer.

The desired way without the issue mentioned above :

Download system tar or zip

Uncompress it and place it in your document root.

cd system

// Download composer via wget if you are a *nix environment or get it from http://getcomposer.org
wget http://getcomposer.org/composer.phar

php composer.phar update

or if you have git itself installed, don't need composer itself. Just run

php update.php

Pear Packages

We have not yet released packages as pear .

I feel its a good idea to start from the coming release.

let composer do autoloading

Check autoload via composer is added for Aura.Di , Aura.Marshal , Aura.Session , Aura.Sql , Aura.Http , Aura.Router , Aura.Signal , Aura.Uri

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.