Download the PHP package tomlerendu/microapi without Composer

On this page you can find all versions of the php package tomlerendu/microapi. 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 microapi

MicroAPI

MicroAPI is an extremely lightweight PHP framework for creating REST APIs.

Requirements

Downloading and Installing

Structure

File system

A MicroAPI application by default has the following structure.

The directory structure can be changed by editing the constants MICROAPI_PATH and APP_PATH in public/const.php then moving the directories to their corresponding locations. It is advisable to keep application code out of the public directory.

The App directory is where you write your application.

The MicroAPI directory contains the framework. If there are multiple websites using MicroAPI on the same system they can be configured to share one copy of it.

The public directory is where the requests enter the framework.

Namespaces and autoloading

MicroAPI follows the PSR-4 standard for autoloading classes.

Request response cycle

Within the App directory there are three files

  1. App/config.php function is executed
  2. App/run.php function is executed
  3. App/routes.php function is executed - If a route is matched its controller is executed

Config

Configuration variables for the application can be defined in App/config.php. By default there are options for the database and response already listed. It's recommended not to define values that have a key starting with microapi..

Routing

Routes for your application are defined in the app/routes.php file. The router will initialise the controller for the first match, once a match has been found the rest of the routes will not be checked.

By default the app/routes.php has two sample routes showing how to setup a function and a class.

Methods

The router has the methods get, post, put, delete which match the corresponding HTTP methods and any which will match any HTTP method.

Routes and wildcards

Extra requirements

The require function allows for any additional requirements to be specified before the route is matched. If anything other than true is returned from the function the route will not be matched.

Controllers

Controllers are dependency injected, they can be either a function or a method on an object.

Services

A service is an object that can be injected at various places in the application, there will only one instance of each service per request. By default MicroAPI comes with six services.

Request

The request object is a representation of the request the user made.

Responses

Responses are "replies" to a clients request, only one response should be sent per request.

Database

The database service is built on top of PDO, it has four convenience functions to make accessing the database easier. For more specific tasks you can access the database directly by calling getConnection() which returns the PDO object.

Injector

Autoloader

Config

Creating a custom service

Models

Known issues


All versions of microapi with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
phpunit/phpunit Version *
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 tomlerendu/microapi contains the following files

Loading the files please wait ....