matthewlefevre / ken-framework
Ken is a backend rest api framework for single page applications.
0.8.5
2020-02-28 18:57 UTC
Requires
- php: >=7.1.0
- phpmailer/phpmailer: ^6.1
- rbdwllr/reallysimplejwt: ^2.1
- vlucas/phpdotenv: ^4.1
Requires (Dev)
- phpunit/phpunit: ^8.5
This package is auto-updated.
Last update: 2025-03-29 00:43:15 UTC
README
Ken Framework
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.
Table of Contents
Installation
Official installation is through composer.
composer require matthewlefevre/Ken-Framework
Usage
Use Ken Framework to create rest applications with php. The following steps can be followed to get started quickly.
Setup
- 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.
Contributing
Pull requests are welcome!
License
Take a look at the LICENSE.md