https://github.com/femtopixel/nano-framework
PHP - Nano Framework - Easier than easiest framework
https://github.com/femtopixel/nano-framework
nano-framework php route site
Last synced: 3 months ago
JSON representation
PHP - Nano Framework - Easier than easiest framework
- Host: GitHub
- URL: https://github.com/femtopixel/nano-framework
- Owner: femtopixel
- License: mit
- Created: 2016-06-10T10:26:12.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2024-05-02T16:09:50.000Z (about 1 year ago)
- Last Synced: 2024-05-03T02:38:41.921Z (about 1 year ago)
- Topics: nano-framework, php, route, site
- Language: PHP
- Homepage: https://brands.jaymoulin.me/femtopixel/nano-framework/
- Size: 117 KB
- Stars: 6
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
Awesome Lists containing this project
README
> [!CAUTION]
> As-of 2021, this product does not have a free support team anymore. If you want this product to be maintained, please support my work.
> [!NOTE]
> (This product is available under a free and permissive license, but needs financial support to sustain its continued improvements. In addition to maintenance and stability there are many desirable features yet to be added.)
Nano Framework
==============[](https://scrutinizer-ci.com/g/femtopixel/nano-framework/build-status/master)
[](https://packagist.org/packages/femtopixel/nano-framework)
[](https://php.net/)
[](https://scrutinizer-ci.com/g/femtopixel/nano-framework/?branch=master)
[](https://scrutinizer-ci.com/g/femtopixel/nano-framework/?branch=master)
[](https://packagist.org/packages/femtopixel/nano-framework)
[](https://www.paypal.me/jaymoulin)
[](https://www.buymeacoffee.com/jaymoulin)
[](https://www.ko-fi.com/jaymoulin)Nano is a simple stupid framework, really easy to handle, and really efficient.
It only implements the C part (Controller) of the MVC design pattern which allows developers to use any other existing library for others parts
Installation
---composer require femtopixel/nano-framework
Bootstrap
---all your request can be redirected to your bootstrap (assuming index.php)
```php
dispatch();
```That's all!
How it works?
---With that on, you can now access to your pages like this :
http://mysite.tld/ \/\
And it will load the class \Project\Controller\\\::\\Action
You can easily configure your namespace, controller package and action suffix!
*\* represents the HTTP method used (usually *get* but you can use post/update/delete etc...). This is optional.
Either \ or \ are optional and considered as 'index' if not defined.
Therefore
url | class::method
---------------------------------------------- | ---------------------------------------
http://mysite.tld/ | \Project\Controller\Index::indexAction
http://mysite.tld/test | \Project\Controller\Test::indexAction
http://mysite.tld/test/action | \Project\Controller\Test::actionAction
http://mysite.tld/also/work/with/full/path | \Project\Controller\Also\Work\With\Full::pathAction
http://mysite.tld/my/normal | \Project\Controller\My::getNormalAction
http://mysite.tld/my/normal (with HTTP post) | \Project\Controller\My::postNormalAction## Parameter Matching
Since 0.6.0, you can use *"Parameter Matching"*
Simply activate it when dispatching :
```php
require_once ('vendor/autoload.php');
$nano = new \Nano\Framework();
$nano->setParameterMatching()->dispatch();
```And then you'll be able to use it like this :
```php