Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
Ark4ne committed Mar 19, 2018
1 parent c183d16 commit 84172a2
Showing 1 changed file with 107 additions and 0 deletions.
107 changes: 107 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,110 @@ class ExampleMiddleware extends ControllerMiddleware implements BeforeInterface
}
```

## View
### Added Functions
`dump` : Dump a variable via `Neutrino\Debug\VarDump::dump`

### Added Extensions
#### PhpFunctionExtension
Add to compilation all php functions.

#### StrExtension
Add to compilation all functions in `Neutrino\Support\Str`.
Called via `str_{func}`

### Added Filters
| filter | do : |
|----------|--------------------------------------|
| `merge` | `array_merge` |
| `split` | `str_split` \ `explode` |
| `slice` | `array_slice` |
| `round` | `round` \ `floor` \ `ceil` |
| `slug` | `Neutrino\Support\Str::slug` |
| `limit` | `Neutrino\Support\Str::limit` |
| `words` | `Neutrino\Support\Str::words` |

### Customize
#### Filters
You can simply add your own filter to volt engine.

First : Create a filter Class :
```php
class MyFilter extends \Neutrino\View\Engines\Volt\Compiler\FilterExtend {

public function compileFilter($resolvedArgs, $exprArgs)
{
return "array_pop($resolvedArgs)";
}
}
```

Then : register your extension in `config\view.php`
```php
// ...
'filters' => [
'pop' => MyFilter::class
]
];
```

#### Functions
You can simply add your own function to volt engine.

First : Create a filter Class :
```php
class MyFunction extends \Neutrino\View\Engines\Volt\Compiler\FunctionExtend{

public function compileFunction($resolvedArgs, $exprArgs)
{
return "str_replace($resolvedArgs)";
}
}
```

Then : register your extension in `config\view.php`
```php
// ...
'functions' => [
'replace' => MyFunction::class
]
];
```

#### Extensions
You can simply add your own extensions to volt engine.

First : Create a extension Class :
```php
class MyExtension extends Neutrino\View\Engines\Volt\Compiler\ExtensionExtend {

public function compileFunction($name, $arguments, $funcArguments) {
// Compile a function
}

public function compileFilter($name, $arguments, $funcArguments) {
// Compile a filter
}

public function resolveExpression($expr) {
// Resolve an expression
}

public function compileStatement($statement) {
// Compile a statement
}
}
```

Then : register your extension in `config\view.php`
```php
// ...
'extensions' => [
MyExtension::class
]
];
```

## Modules (HMVC)
Modules is optional, and only available for the Http Kernels.

Expand Down Expand Up @@ -1060,6 +1164,9 @@ $builder->enableForeignKeyConstraints();
$builder->disableForeignKeyConstraints();
```

# Built-In Server
Use `php quark server:run` to run php built-in server on your application.

# Config and Environment

To work, nucleon, and neutrino, need to have 3 constants defined :
Expand Down

0 comments on commit 84172a2

Please sign in to comment.