From 8eefeaf19e28db462f6f61dc8daf5c63f17bc65e Mon Sep 17 00:00:00 2001 From: Natan Felles Date: Wed, 22 Jun 2022 18:21:29 -0300 Subject: [PATCH] Update User Guide --- guide/index.rst | 80 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/guide/index.rst b/guide/index.rst index 9e5179c..4f583e5 100644 --- a/guide/index.rst +++ b/guide/index.rst @@ -7,6 +7,11 @@ One Aplus Framework One Project. - `Installation`_ +- `Structure`_ +- `Configuration`_ +- `Routing`_ +- `Running`_ +- `Conclusion`_ Installation ------------ @@ -16,3 +21,78 @@ The installation of this project can be done with Composer: .. code-block:: composer create-project aplus/one:dev-master + +or with the `Aplus Command Line Tool `_: + +.. code-block:: + + aplus new-one + +Structure +--------- + +Project One has a minimalistic structure, with an index.php file being the only, +or main, application file. + +With just one file it is possible to create a simple website or a microservice. + +It shows the versatility of how it is possible to structure an application with +the Aplus Framework. + +This is the basic directory tree: + +.. code-block:: + + . + ├── composer.json + ├── preload.php + ├── public/ + │ └── index.php + ├── storage/ + │ └── logs/ + ├── tests/ + └── vendor/ + +And remember, it's highly customizable. You can adapt it as you like. + +Configuration +------------- + +The application's configurations are set directly in the App class constructor, +where, by default, only two services are set; the **exceptionHandler** and the +**logger**. Which shows a beautiful page when exceptions are thrown and is also +able to save logs in the ``storage/logs`` directory. + +Routing +------- + +The routing is defined directly in the index.php file, as it is expected not to +contain too many lines. By default, only the route with the root path of the URL +is set, and also a customization in the Error 404 page. Both return a closure +with an array to be JSON-encoded. + +Running +------- + +Finally, the application will respond to HTTP requests. As per the last line of +the index.php file: + +.. code-block:: php + + $app->runHttp(); + +If the application also responds from the command line, it is possible to use +the ``run`` method and, if it is only for the command line; ``runCli``. + +Conclusion +---------- + +Aplus One Project is an easy-to-use tool for, beginners and experienced, PHP developers. +It is perfect for creating simple, high-performance applications. +The more you use it, the more you will learn. + +.. note:: + Did you find something wrong? + Be sure to let us know about it with an + `issue `_. + Thank you!