PHPackages                             firehed/api - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. firehed/api

ActiveLibrary[API Development](/categories/api)

firehed/api
===========

An API framework

3.2.2(7y ago)15.8k[13 issues](https://github.com/Firehed/api/issues)[7 PRs](https://github.com/Firehed/api/pulls)MITPHPPHP ^7.0

Since Sep 17Pushed 3y ago1 watchersCompare

[ Source](https://github.com/Firehed/api)[ Packagist](https://packagist.org/packages/firehed/api)[ RSS](/packages/firehed-api/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (10)Dependencies (13)Versions (39)Used By (0)

API Framework
=============

[](#api-framework)

[![Build Status](https://github.com/Firehed/api/workflows/Test/badge.svg?branch=master)](https://github.com/Firehed/api/actions?query=workflow%3ATest+branch%3Amaster)[![codecov](https://camo.githubusercontent.com/affe7227a1cc1aa45aa1626587e9d1989617b883fbbded48796c3d9d387d5aa6/68747470733a2f2f636f6465636f762e696f2f67682f466972656865642f6170692f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/Firehed/api)

Installation
------------

[](#installation)

API is available via composer:

`composer require firehed/api`

Usage
-----

[](#usage)

Set up an `.apiconfig` file, which contains JSON-formatted settings for the framework. You may run `vendor/bin/api generate:config` to do this. See configuration below for additional information.

Generate a default front-controller:

`vendor/bin/api generate:frontController`

After creating, modifying, or deleting endpoints, run the compiler:

`vendor/bin/api compile:all`

This step is *not* optional: the framework depends on the generated files, rather than ever attempting to perform the same step at runtime. It is expected that you will rebuild the files on every build/deployment with the above command. See the section on best practices below.

Testing
-------

[](#testing)

For convenience, a trait is included that includes tests for the description methods of your endpoints. In your test case class (which typically extends `PHPUnit\Framework\TestCase`, use the trait:

`\Firehed\API\Traits\EndpointTestCases`

And add a `getEndpoint` method that returns an instance of the endpoint under test.

### Example

[](#example)

```
