Download the PHP package rozbehsharahi/fhp-rest-api without Composer

On this page you can find all versions of the php package rozbehsharahi/fhp-rest-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package fhp-rest-api

FHP REST API Build Status (Master Build Status)

Description

FHP REST API provides an easy way to setup a JSON FILE based REST API.

There are no dependencies to MySQL or other databases. All files will be stored as json files by default. Still you may also integrate your own way of saving data, by integrating your own controllers, entites and normalizers.

I'm trying really hard to make this very flexible and at the same easy to understand, i hope you enjoy working with this.

Installation

How to

The following index.php is enough to provide PUT, GET, POST, OPTION, DELETE routes for your application on the /posts route:

That's it!

How to use entity classes

(Still experimental)

This way of using FHP REST API is still very experimental, so please used this with caution. For instance you have to define fhp property type annotations, though they don't have any impact on the way a property is saved yet.

Your entity class should look like this:

At the moment it does not make any difference which property type you will use. But it is a good preparation for next releases. You will still have to annotate with one of the following annotations:

Defining custom entity-controllers

You may also define your own controllers to handle model-requests. Just pass your controller's class name as the third parameter to $api->createModel.

Please extend Fhp\Rest\Controller and feel free to override the basic actions:

by calling $api->activateEntity like following:

Super fast start without Apache

No apache, No MySQL, just make sure PHP is installed on your machine.

Since FHP REST API is super independent you may start your server on almost any machine that supports PHP7+ (in future also PHP5.6+). Not even Apache is needed to get it started. Just change your directory to the projects root and go on with:

Start with Apache

In case you want to start FHP REST API on an apache server, please add the following .htaccess file to your project's root where index.php is located.

Security issues / CORS

FHP REST API has a set of default-headers that are defined in Fhp\Rest\Api. These headers also contain 'Access-Control-Allow-Origin' => '*' which is a security issue depending on the project.

Please make sure to configure your own header-settings when going to production.

You may do this by following:

Todos and issues


All versions of fhp-rest-api with dependencies

PHP Build Version
Package Version
Requires slim/slim Version ^3.7
icanboogie/inflector Version ^1.4
doctrine/common Version ^2.6
mikey179/vfsstream Version ^1.6
phpunit/phpunit Version 5.7.*
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package rozbehsharahi/fhp-rest-api contains the following files

Loading the files please wait ....