Skip to content

Commit

Permalink
Work on docs
Browse files Browse the repository at this point in the history
  • Loading branch information
nicksagona committed Oct 26, 2015
1 parent 1f84ae2 commit 2c05e1e
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 5 deletions.
10 changes: 5 additions & 5 deletions getting_started/applications.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,20 @@ through the appropriate methods:

.. code-block:: php
$app->router()->addRoute($router, $controller);
$app->router->addRoute($router, $controller);
**Access the service locator**

.. code-block:: php
$sess = $app->services()->get('session');
$sess = $app->services['session'];
**Access the event manager**

.. code-block:: php
$app->events()->on('app.init', $action);
$app->events->on('app.init', $action);
You can pass in configuration values that your application may need during its life-cycle
via an array or array-like object:
Expand All @@ -82,7 +82,7 @@ via an array or array-like object:
'foo' => 'bar'
]);
$foo = $app->config()['foo'];
$foo = $app->config['foo'];
You can also pass in the autoloader if it is needed as well:

Expand All @@ -92,7 +92,7 @@ You can also pass in the autoloader if it is needed as well:
$app = new Pop\Application($autoloader);
$app->autoloader()->addPsr4('MyApp\\Foo', __DIR__ . '/foo/src');
$app->autoloader->addPsr4('MyApp\\Foo', __DIR__ . '/foo/src');
Running an Application
----------------------
Expand Down
38 changes: 38 additions & 0 deletions getting_started/routing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -212,3 +212,41 @@ And the follow routes would be valid because of dynamic route matching:

* ``users``
* ``users edit 1001``

HTTP Route Syntax
-----------------

+---------------------------------+---------------------------------------------------------------------+
| Web Route | What's Expected |
+=================================+=====================================================================+
| /foo/:bar/:baz | All 3 params are required |
+---------------------------------+---------------------------------------------------------------------+
| /foo[/:bar][/:baz] | First param required, last two are optional |
+---------------------------------+---------------------------------------------------------------------+
| /foo/:bar[/:baz] | First two params required, last one is optional |
+---------------------------------+---------------------------------------------------------------------+
| /foo/:bar/:baz[/:some][/:other] | Two required, two optional |
+---------------------------------+---------------------------------------------------------------------+
| /foo/:bar/:baz* | One required param, one required param that is a collection (array) |
+---------------------------------+---------------------------------------------------------------------+
| /foo/:bar[/:baz*] | One required param, one optional param that is a collection (array) |
+---------------------------------+---------------------------------------------------------------------+

CLI Route Syntax
----------------

+-------------------------------------+----------------------------------------------------------------------+
| CLI Route | What's Expected |
+=====================================+======================================================================+
| foo bar | All 2 params are required |
+-------------------------------------+----------------------------------------------------------------------+
| foo [bar\|baz] | First param required, 2nd param has optional 2 values |
+-------------------------------------+----------------------------------------------------------------------+
| foo -o1 [-o2] | First param required, 1st option required, 2nd option optional |
+-------------------------------------+----------------------------------------------------------------------+
| foo --option1\|-o1 [--option2\|-o2] | First param required, 1st option required, 2nd option optional |
+-------------------------------------+----------------------------------------------------------------------+
| foo \<name\> [\<email\>] | First param required, 1st value required, 2nd value optional |
+-------------------------------------+----------------------------------------------------------------------+
| foo --name= [--email=] | First param required, 1st opt value required, 2nd opt value optional |
+-------------------------------------+----------------------------------------------------------------------+

0 comments on commit 2c05e1e

Please sign in to comment.