Skip to content

Commit

Permalink
Update docs structure
Browse files Browse the repository at this point in the history
Signed-off-by: crynobone <crynobone@gmail.com>
  • Loading branch information
crynobone committed Dec 7, 2013
1 parent 9e74d55 commit 37b67d8
Show file tree
Hide file tree
Showing 5 changed files with 121 additions and 135 deletions.
31 changes: 16 additions & 15 deletions docs/changes.md
Original file line number Diff line number Diff line change
@@ -1,60 +1,61 @@
Support Change Log
==============
---
title: Support Change Log
---

## Version 2.0
## Version 2.0 {#v2-0}

### v2.0.11
### v2.0.11 {#v2-0-11}

* Refactor and Simplify `Orchestra\Support\Nesty`.
* Implement [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md) coding standard.

### v2.0.10
### v2.0.10 {#v2-0-10}

* `Illuminate\Support\Str::title()` is implemented, remove duplicate method.
* Add support to use `Orchestra\Support\Validator::extendScope()`, useful to have when need to deal with conditional rules <http://laravel.com/docs/validation#conditionally-adding-rules>.
* Refactor `Orchestra\Support\Str::streamGetContents()`.

### v2.0.9
### v2.0.9 {#v2-0-9}

* Add `Orchestra\Support\Nesty::is()` to return instance of `Illuminate\Support\Fluent` to allow further chaining of the instance.

### v2.0.8
### v2.0.8 {#v2-0-8}

* Add `Orchestra\Support\Str::searchable()` for better pattern matching.
* Add Guardfile.

### v2.0.7
### v2.0.7 {#v2-0-7}

* Add `Orchestra\Support\Messages::extend()` and tweak how Messages notification can be manipulated on current request.

### v2.0.6
### v2.0.6 {#v2-0-6}

* Code improvements.
* Add `Orchestra\Support\Ftp\RuntimeException::getParameters()`.

### v2.0.5
### v2.0.5 {#v2-0-5}

* Fixed an invalid called to `Orchestra\Support\Nesty::add_parent()`.
* Allow `Orchestra\Support\Nesty` to prepend an item without knowing the current first item.

### v2.0.4
### v2.0.4 {#v2-0-4}

* Refactor `Orchestra\Support\Validator` to minimize usage of `Illuminate\Support\Fluent`, this allow rules to be assigned as array and only pass as instance of Fluent during event (to allow pass by references).

### v2.0.3
### v2.0.3 {#v2-0-3}

* Allow `Orchestra\Support\Validator::on()` should accept additional parameters.
* Add `Orchestra\Support\Validator::setRules()` to override rules, and set it as an instanceof `Illuminate\Support\Fluent`.

### v2.0.2
### v2.0.2 {#v2-0-2}

* `Orchestra\Support\Manager` should be able to set blacklisted name, for example `Orchestra\Memory` shouldn't allow dotted.

### v2.0.1
### v2.0.1 {#v2-0-1}

* `Orchestra\Support\Validator::$rules` should utilize `Illuminate\Support\Fluent`.

### v2.0.0
### v2.0.0 {#v2-0-0}

* Migrate `Orchestra\Support` from Orchestra Platform 1.2.
* Split service provider to `Orchestra\Support\DecoratorServiceProvider` and `Orchestra\Support\MessagesServiceProvider`.
Expand Down
109 changes: 54 additions & 55 deletions docs/manager.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Using Manager
==============
---
title: Using Manager
---

`Orchestra\Manager` is a small improvement to `Illuminate\Support\Manager`, which allow multi-ton driver based factory design pattern for your class.

Expand All @@ -11,64 +12,62 @@ While in most cases you would not need to use multi-instance of the same driver

With following `Orchestra\Widget\WidgetManager`, it's possible to have an instance of `Orchestra\Widget::make("menu.orchestra")` and `Orchestra\Widget::make("menu.app")` without a conflict.

```php
<?php namespace Orchestra\Widget;
<?php namespace Orchestra\Widget;

use InvalidArgumentException;
use Closure;
use Orchestra\Support\Manager;
use InvalidArgumentException;
use Closure;
use Orchestra\Support\Manager;

class WidgetManager extends Manager {
class WidgetManager extends Manager {

/**
* Define blacklisted character in name.
*
* @var
*/
protected $blacklisted = array();
/**
* Define blacklisted character in name.
*
* @var
*/
protected $blacklisted = array();

/**
* Create Menu driver.
*
* @param string $name
* @return \Orchestra\Widget\Drivers\Menu
*/
protected function createMenuDriver($name)
{
return new Drivers\Menu($this->app, $name);
}
/**
* Create Menu driver.
*
* @param string $name
* @return \Orchestra\Widget\Drivers\Menu
*/
protected function createMenuDriver($name)
{
return new Drivers\Menu($this->app, $name);
}

/**
* Create Pane driver.
*
* @param string $name
* @return \Orchestra\Widget\Drivers\Pane
*/
protected function createPaneDriver($name)
{
return new Drivers\Pane($this->app, $name);
}
/**
* Create Pane driver.
*
* @param string $name
* @return \Orchestra\Widget\Drivers\Pane
*/
protected function createPaneDriver($name)
{
return new Drivers\Pane($this->app, $name);
}

/**
* Create Placeholder driver.
*
* @param string $name
* @return \Orchestra\Widget\Drivers\Placeholder
*/
protected function createPlaceholderDriver($name)
{
return new Drivers\Placeholder($this->app, $name);
}
/**
* Create Placeholder driver.
*
* @param string $name
* @return \Orchestra\Widget\Drivers\Placeholder
*/
protected function createPlaceholderDriver($name)
{
return new Drivers\Placeholder($this->app, $name);
}

/**
* Create default driver.
*
* @param string $name
* @return string
*/
protected function getDefaultDriver()
{
return 'placeholder.default';
/**
* Create default driver.
*
* @param string $name
* @return string
*/
protected function getDefaultDriver()
{
return 'placeholder.default';
}
}
}
```
64 changes: 28 additions & 36 deletions docs/messages.md
Original file line number Diff line number Diff line change
@@ -1,55 +1,47 @@
Using Messages
==============
---
title: Using Messages
---

`Orchestra\Messages` utilize `Illuminate\Support\MessageBag` to bring notification support through-out Orchestra Platform (and Laravel 4).

## Adding a Message
* [Adding a Message](#add-message)
* [Extending a Message to Current Response](#extend-for-current-request)
* [Displaying the Message in a View](#displaying-message)

## Adding a Message {#add-message}

Adding a message is as easy as following:

```php
Orchestra\Messages::add('success', 'A successful message');
```
Orchestra\Messages::add('success', 'A successful message');

You can also chain messages:

```php
Orchestra\Messages::add('success', 'A successful message')
->add('error', 'Some error');
```
</article>
Orchestra\Messages::add('success', 'A successful message')
->add('error', 'Some error');

## Extending a Message to Current Response
## Extending a Message to Current Response {#extend-for-current-request}

There might be situation where you need to extend a message to the current response instead of the following request. You can do this with:

```php
Orchestra\Messages::extend(function ($message)
{
$message->add('info', 'Read-only mode');
});
```
Orchestra\Messages::extend(function ($message) {
$message->add('info', 'Read-only mode');
});

## Displaying the Message in a View
## Displaying the Message in a View {#displaying-message}

Here's an example how you can display the message:

```php
<?php

$message = Orchestra\Messages::retrieve();

if ($message instanceof Orchestra\Support\Messages)
{
foreach (['error', 'info', 'success'] as $key)
{
if ($message->has($key))
{
$message->setFormat(
'<div class="alert alert-'.$key.'">:message</div>'
);
echo implode('', $message->get($key));
<?php
$message = Orchestra\Messages::retrieve();
if ($message instanceof Orchestra\Support\Messages) {
foreach (['error', 'info', 'success'] as $key) {
if ($message->has($key)) {
$message->setFormat(
'<div class="alert alert-'.$key.'">:message</div>'
);
echo implode('', $message->get($key));
}
}
}
}
```
28 changes: 12 additions & 16 deletions docs/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,23 @@ Support Component

`Orchestra\Support` is basically a basic set of class required by Orchestra Platform. The idea behind it is similar to what is `Illuminate\Support` to Laravel 4 Framework.

## Installation
## Installation {#installation}

To install through composer, simply put the following in your `composer.json` file:

```json
{
"require": {
"orchestra/support": "2.0.*"
{
"require": {
"orchestra/support": "2.0.*"
}
}
}
```

## Configuration
## Configuration {#configuration}

Next add the service provider in `app/config/app.php`.

```php
'providers' => array(

// ...

'Orchestra\Support\MessagesServiceProvider',
),
```
'providers' => array(

// ...

'Orchestra\Support\MessagesServiceProvider',
),
24 changes: 11 additions & 13 deletions docs/str.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,27 @@
String Helper Class
==============
---
title: String Helper Class
---

`Orchestra\Support\Str` is probably one of the few internal API class that you might use directly. It extends `Illuminate\Support\Str` and offer some improvement.

* [Title](#title)
* [Title](#str-title)
* [Stream Get Contents](#stream-get-contents)

## Title
## Title {#str-title}

Allow a string to be transformed to a proper title.

```php
use Orchestra\Support\Str;
use Orchestra\Support\Str;

return Str::title('hello-world'); // would return "Hello World"
```
return Str::title('hello-world'); // would return "Hello World"

## Stream Get Contents
## Stream Get Contents {#stream-get-contents}

Unliked other database driver, when using blob with PostgreSQL, the return value from database is a stream instead of string, using above helper method help convert it properly back to string.

```php
use Orchestra\Support\Str;
use Orchestra\Support\Str;

$str = Str::streamGetContents($blob);

$str = Str::streamGetContents($blob);
```

> The method would return original string when it detect that it isn't a stream.

0 comments on commit 37b67d8

Please sign in to comment.