diff --git a/getting_started/applications.rst b/getting_started/applications.rst index aeda19e..57933ae 100644 --- a/getting_started/applications.rst +++ b/getting_started/applications.rst @@ -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: @@ -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: @@ -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 ---------------------- diff --git a/getting_started/routing.rst b/getting_started/routing.rst index fd9d143..ae2792c 100644 --- a/getting_started/routing.rst +++ b/getting_started/routing.rst @@ -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 \ [\] | First param required, 1st value required, 2nd value optional | ++-------------------------------------+----------------------------------------------------------------------+ +| foo --name= [--email=] | First param required, 1st opt value required, 2nd opt value optional | ++-------------------------------------+----------------------------------------------------------------------+