Ken is a simple PHP framework adapted to create custom REST API's. Ken provides a simple way to create secure API endpoints and the space needed to build out business logic in a scalable way. This Framework is still in a rapid development stage and we have not created a base stable version as of yet.
Official installation is through composer.
composer require matthewlefevre/Ken-Framework
Use Ken Framework to create rest applications with php. The following steps can be followed to get started quickly.
- Create an api.php file that follows the pattern in
api.php.example
<?php
require_once $_SERVER['DOCUMENT_ROOT'] . '/vendor/autoload.php';
/**
* Sample Server File
*
* This outlines the general structure of the
* server file.
*/
use KenFramework\Ken;
// CSRF (cross-site request forgery) vulnerability
// due to serving spa's on seprate local server for
// development. Remove headers before launching
// product
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Headers: Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With");
header("Access-Control-Allow-Methods: GET,POST,PUT,DELETE,OPTIONS");
// Always returns JSON to the client
header("Content-Type: application/json");
// Instantiate app
$app = new Ken();
$app->start();
- Require vlucas/phpdotenv package to manage global variables ken uses
composer require vlucal/phpdotenv
- Create .env file with the following attributes after the manner of .env.example
KEN_SECRET=""
KEN_DB=""
KEN_DB_USER=""
KEN_DB_PASSWORD=""
KEN_SERVER=""
- Ensure that you have phpMyAdmin installed and configured in your local enviornment. The built in model class is only compatable with mySQL.
- Create a new database
- Fill in the correct enviornment variables
- If you have XAMPP installed either require composer into your htdocs folder. If you don't have XAMPP installed or do not want to run the server on localhost be sure to create virtual hosts on your operating system and in your apache server configuration.
Pull requests are welcome!
Take a look at the LICENSE.md