sensorario / wheel-basic-app
basic application based on wheel components
1.0.0
2016-10-27 16:21 UTC
Requires
- sensorario/wheel-container: 1.0.2
- sensorario/wheel-framework: ^1.1
README
prompt> composer create-project sensorario/wheel-basic-app --prefer-dist prompt> php -S localhost:8666 -t web
Wheel basic application
├── app │ └── config │ └── config.db.php ├── src │ └── MyApi │ ├── Components │ │ └── Config.php │ └── Controllers │ └── DefaultController.php ├── web │ └── index.php ├── composer.json ├── composer.lock └── readme.md
Controller
<?php namespace MyApi\Controllers; use Sensorario\WheelFramework\Controllers\Controller; class DefaultController extends Controller { public function default() { $response = [ 'message' => 'welcome', ]; return $response; } }
Create new routes
<?php namespace MyApi\Components; use Sensorario\WheelFramework\Components\Config as SensorarioConfig; class Config implements SensorarioConfig { public function getConfig($key) { return array( 'routes' => array( <path> => array( 'controller' => <controller>, <http method> => array( 'action' => <method> ) ) ), )[$key]; } }
If you want to add new json endpoint to show developer information:
'/devel/info' => array( 'controller' => 'Vendor\\Controllers\\DevelController', 'GET' => array( 'action' => 'show' ) )
Database
app/config/config.db.php
<?php return array( 'driver' => 'pdo_mysql', 'dbname' => 'my_api', 'user' => 'root', 'password' => '', );