PHPackages                             jasir/raml-server - 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. jasir/raml-server

ActiveLibrary[API Development](/categories/api)

jasir/raml-server
=================

0.0.1(9y ago)61.0k3[4 issues](https://github.com/jasir/php-raml-server/issues)MITPHP

Since Aug 7Pushed 8y ago4 watchersCompare

[ Source](https://github.com/jasir/php-raml-server)[ Packagist](https://packagist.org/packages/jasir/raml-server)[ RSS](/packages/jasir-raml-server/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (10)Versions (3)Used By (0)

\#PHP RAML Server

[![Build Status](https://camo.githubusercontent.com/4a140418c6be7577e808d49a0f1229021fa25a4f4ba596d184fbab9bc5c5ba2e/68747470733a2f2f7472617669732d63692e6f72672f6a617369722f7068702d72616d6c2d7365727665722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/jasir/php-raml-server)

Forked from [https://github.com/dethbird/PHP\_RAML\_Server](https://github.com/dethbird/PHP_RAML_Server)

New Features:

- multiple raml can live on server
- serving correct \*.raml files with correctly set `BaseUri`
- easy integration to existing site and any framework

TBD:

- refactor out calling real implementation to remove need extend Controller
- refactor authorisation

Please look at clone &amp; run example of server: ...

Integration with Nette framework + fully working API server:

Here is gist with notebook examples:

---

Original documentation here...

\##Overview

This is an implementation of a Apache/PHP server which takes a [RAML](http://raml.org) API specification and stubs a working API server leveraging the [Slim Microframework](http://www.slimframework.com/).

The developer does the actual implementation of the specified API methods. Required query parameters, headers, and body elements are validated before execution of these custom methods, and a `400 Bad Request` is returned on error. It also has a way to request the response examples and schemas defined in the RAML for reflection discussed below in the usage section.

\##Requirements

A web server running PHP 5.5+. You can follow [these instructions](aws-ec2-howto.md) to spin up a free Amazon EC2 with everything you need including a mysql persistence layer for the actual method implementations.

\##Setup

\####Make Make sure /public is the docroot for the host

```
# Run composer in project root
composer install
```

\####Configs

```
# in project root
mv configs/configs.example.yml configs/configs.yml
```

\##Change the API

\####RAML Specs The RAML API definitions reside in `somedir/{version}/{api_name}.raml`

- `{version}`is determined by the version number in the api for example in  the version is "v1.1"
- `{api_name}` comes from configs and can me something like "pizza\_delivery\_api" or "movie\_quote\_reference\_api". Basically by changing this, you are telling the RAML Server what API personality it should assume.

Note: Make sure that the RAML doc you define has the same version number as the folder name that it lives in:

```
#%RAML 0.8
title: Pizza Delivery API
version: v1.0 #be mindful that this matches the folder where it resides
```

\####Method Definitions Method Definitions live in user generated classes at `/methods/{version}{api_name|UnderscoreToUcwords}.php`.

> Example: `pizza_delivery_api` would map to `/methods/{version}/PizzaDeliveryApi.php`.

These classes must extend `MethodsBase()`. They contain methods that directly map to requests.

```
