Skip to content

Commit

Permalink
DI Container injected via App constructor (Modified according to Faca…
Browse files Browse the repository at this point in the history
…de support inside core)
  • Loading branch information
afonzeca committed Dec 2, 2018
1 parent 05cf183 commit 48215a2
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .envcli
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ APP_NAME="Arun"
#
# APPLICATION VERSION
#
APP_VERSION="0.44.2-alpha"
APP_VERSION="0.45-alpha"

#
# COMMAND LINE COLORS (0 = disabled, 1 = enabled)
Expand Down
43 changes: 36 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## "Arun" (CLI Microframework) for PHP7.2+ - Version 0.44.2-alpha - (C) 2018 by Angelo Fonzeca
## "Arun" (CLI Microframework) for PHP7.2+ - Version 0.45-alpha - (C) 2018 by Angelo Fonzeca

<p align="center">
<img src="docs/images/arunlogo.jpg">
Expand All @@ -15,6 +15,7 @@
* [Code Auto Generation](#code-auto-generation)
* [Configuration File Support](#configuration-file-support)
* [Phar self-contained executable generation](#phar-self-contained-executable-generation)
* [Facades support](#facades-support)
* [What about the internal Arun Engine?](#what-about-the-internal-arun-engine)
* [What's next?](#whats-next)
* [License Info](#license-info)
Expand All @@ -29,9 +30,11 @@ frameworks/libraries (Like Symfony Console component, Silly, etc.) because Arun
managing commands and associated code (your console application).

The Arun Microframework has an "out-of-the-box" native support for Dependency Injection by using _Containers_ and _Autowire_
(thanks to PHP-DI) and an organized tree for easily writing your code in a simple way.
(thanks to PHP-DI), facades and an organized tree for easily writing your code in a simple way.

Starting from the 0.44.2-alpha version, Arun can auto-generate code for fast and easy development (See Chapter 'Code Auto-Generation' for further information).
Starting from the 0.43-alpha version, Arun can auto-generate code for fast and easy development (See Chapter 'Code Auto-Generation' for further information).

After your project is finished, you can also create a self-contained executable (.phar) thanks to gen:phar embedded action.

_DISCLAIMER: This product is a prototype at an early stage of development and could have security issues... DO NOT USE IT IN PRODUCTION ENVIRONMENTS_

Expand Down Expand Up @@ -195,7 +198,7 @@ Arun will do the job for you...
```bash
./arun table

Arun Microframework 0.44.2-alpha - (C) 2018 by Angelo Fonzeca (Apache License 2.0)
Arun Microframework 0.45-alpha - (C) 2018 by Angelo Fonzeca (Apache License 2.0)

Table: This Domain allows to interact with tables

Expand Down Expand Up @@ -296,7 +299,7 @@ Now you can call Arun with one, two, or three parameters...
If you type ./arun table:create without parameters you will receive an automatic help... like this:

```
Arun Microframework 0.44.2-alpha - (C) 2018 by Angelo Fonzeca (Apache License 2.0)
Arun Microframework 0.45-alpha - (C) 2018 by Angelo Fonzeca (Apache License 2.0)
Table: Table creation
Expand All @@ -316,7 +319,7 @@ create
if you type ./arun without commands, actions, etc. you will receive a "global help" like this:

```
Arun Microframework 0.44.2-alpha - (C) 2018 by Angelo Fonzeca (Apache License 2.0)
Arun Microframework 0.45-alpha - (C) 2018 by Angelo Fonzeca (Apache License 2.0)
Default: A Convention Over Configuration CLI Micro-Framework
Expand Down Expand Up @@ -563,7 +566,7 @@ ARUN has a built-in domain called "gen" dedicated to code-generation. Let's see
./arun gen
Arun Microframework 0.44.2-alpha - (C) 2018 by Angelo Fonzeca (Apache License 2.0)
Arun Microframework 0.45-alpha - (C) 2018 by Angelo Fonzeca (Apache License 2.0)
Gen: Generates code for Arun Development Speed-up
Expand Down Expand Up @@ -923,6 +926,32 @@ NOTES:

* If you need to write/edit/manipulate files with your generated .phar application, remember in your code to specify absolute paths and/or use "getcwd" function. The ``` __DIR__ ``` will refer to path INSIDE the package and your code will not work outside that "box".

### Facades support

Arun supports a simple implementation of Facades for its internal core classes.

For using them, use the statment "use" for including their namespace into your classes.

The base namespace is "ArunCore\Facades\...FacadeName...", where "...FacadeName..." is one of the following:

* ActionManipulator ("ArunCore\\Core\\CodeBuilders\\ActionManipulator")
* ContentGenerator ("ArunCore\\Core\\IO\\FileContentGenerator")
* Core ("ArunCore\\Core\\ArunCore")
* DomainManipulator ("ArunCore\\Core\\CodeBuilders\\DomainManipulator")
* Executor ("ArunCore\\Core\\Domain\\DomainActionExecutor")
* HelpGenerator ("ArunCore\\Core\\CodeBuilders\\ActionManipulator")
* Input ("ArunCore\\Core\\IO\\ConsoleInput")
* LLHelper ("ArunCore\\Core\\Helpers\\LowLevelHelper")
* NameGenerator ("ArunCore\\Core\\Domain\\DomainActionNameGenerator")
* Output ("ArunCore\\Core\\IO\\ConsoleOutput")
* Sanitizer ("ArunCore\\Core\\Helpers\\Sanitizer")

You can utilize facade in this way:

```php
$isClassNameValid = Sanitizer::isClassNameValid("Hello");
```

### What about the internal Arun Engine? ###

When you call Arun, it performs the following steps (It's not Black Magic :D)
Expand Down
5 changes: 3 additions & 2 deletions app/Console/Domains/ExampleDomain.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
namespace App\Console\Domains;

use ArunCore\Annotations as SET;
use ArunCore\Facades\Sanitizer;

/**
* Class ExampleDomain
Expand Down Expand Up @@ -63,6 +64,6 @@ public function hello($name, $yourPlanet = "Earth")
*/
public function bye()
{
$this->cOut->writeln("Bye");
echo "Bye";
}
}
}
3 changes: 1 addition & 2 deletions arun
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ $container = require __DIR__ . "/kickstart/kickstart.php";
*/
try {

$App = new \ArunCore\Core\App();
$App->setContainer($container);
$App = new \ArunCore\Core\App($container);
$App->run();

} catch (\Exception $ex) {
Expand Down
8 changes: 7 additions & 1 deletion changelog.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
List of changes:

* v0.44.2 - alpha - Changes Made:
* v0.45.* - alpha - Changes Made:

1) Added facade support
2) DI Container inject in APP via constructor
3) README.md update

* v0.44.* - alpha - Changes Made:
1) Improved help autogeneration
2) Introducted box.json for PHAR generation
3) Added gen:disableDomain
Expand Down

0 comments on commit 48215a2

Please sign in to comment.