Skip to content

Commit

Permalink
Fix documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
zachleigh committed Apr 22, 2017
1 parent 995ba58 commit 653969a
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 33 deletions.
66 changes: 34 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -866,38 +866,9 @@ Refreshing the database will rollback all migrations and then re-run them all in
php yarak migrate:refresh
```

When using the `migrate:refresh` command, you may also use the `--seed` flag to run all your [database seeders](#database-seeding) after the database has been refreshed. See [Using Database Seeders](#using-database-seeders) for more information.
When using the `migrate:refresh` command, you may also use the `--seed` flag to run all your [database seeders](#database-seeding) after the database has been refreshed. See [Using Database Seeders](#using-database-seeders) for more information.

## Calling Yarak In Code
To call a Yarak command from your codebase, use the Yarak::call static method.
```php
public static function call($command, array $arguments = [], \Phalcon\DiInterface $di = null)
```
For example, to call `migrate:rollback --steps=2`:
```php
use Yarak\Yarak;

Yarak::call('migrate:rollback', [
'--steps' => 2,
]);
```

Yarak will use the default DI to get its settings. If the resolved default DI is not working, pass an instance of Phalcon\Di as the third argument to the call method:
```php
use Yarak\Yarak;

Yarak::call('migrate:rollback', [
'--steps' => 2,
], $di);
```

If you are running PHP 5.6 or lower, using the static call method may result in the following error message:
```
Cannot bind an instance to a static closure
```
To avoid this error, pass the $di as the third variable to Yarak::call as shown above.

[Top](#contents)
[Top](#contents)

## Custom Commands
Yarak can also be extended and used as a general command line task runner.
Expand Down Expand Up @@ -1146,7 +1117,38 @@ Onces registered, the commands may be used like any other Yarak command:
php yarak namespace:name arg --opt
```

[Top](#contents)
[Top](#contents)

## Calling Yarak In Code
To call a Yarak command from your codebase, use the Yarak::call static method.
```php
public static function call($command, array $arguments = [], \Phalcon\DiInterface $di = null)
```
For example, to call `migrate:rollback --steps=2`:
```php
use Yarak\Yarak;

Yarak::call('migrate:rollback', [
'--steps' => 2,
]);
```

Yarak will use the default DI to get its settings. If the resolved default DI is not working, pass an instance of Phalcon\Di as the third argument to the call method:
```php
use Yarak\Yarak;

Yarak::call('migrate:rollback', [
'--steps' => 2,
], $di);
```

If you are running PHP 5.6 or lower, using the static call method may result in the following error message:
```
Cannot bind an instance to a static closure
```
To avoid this error, pass the $di as the third variable to Yarak::call as shown above.

[Top](#contents)

## Credits and Contributing
This project is largely inspired by the [Laravel project](https://github.com/laravel). Some portions of code in Yarak were taken directly from the Laravel project. Many thanks to @taylorotwell and the rest of the Laravel contributors.
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/ConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function setUp()
/**
* @test
*/
public function config_gits_values_through_property_call()
public function config_gets_values_through_property_call()
{
$this->assertEquals(
'MyApp',
Expand Down

0 comments on commit 653969a

Please sign in to comment.