PHPackages                             eden/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. [HTTP &amp; Networking](/categories/http)
4. /
5. eden/server

ActiveLibrary[HTTP &amp; Networking](/categories/http)

eden/server
===========

Express style server

4.0.2(10y ago)17.7k1MITPHPPHP &gt;=5.4.1

Since Oct 6Pushed 10y ago3 watchersCompare

[ Source](https://github.com/Eden-PHP/Server)[ Packagist](https://packagist.org/packages/eden/server)[ Docs](http://eden-php.com)[ RSS](/packages/eden-server/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (3)Dependencies (4)Versions (5)Used By (1)

[![logo](https://camo.githubusercontent.com/683ba05b2b51f50045c674b19a4f0ceb30702a8ab495623be7c02e07ab226f08/687474703a2f2f6564656e2e6f70656e6f766174652e636f6d2f6173736574732f696d616765732f636c6f75642d736f6369616c2e706e67)](https://camo.githubusercontent.com/683ba05b2b51f50045c674b19a4f0ceb30702a8ab495623be7c02e07ab226f08/687474703a2f2f6564656e2e6f70656e6f766174652e636f6d2f6173736574732f696d616765732f636c6f75642d736f6369616c2e706e67) Eden Server
=================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#-eden-server)

[![Build Status](https://camo.githubusercontent.com/b442d3678cd3f4ece7392f7e22f2d775ed8daffdb78ef4fa6e03709a52fa0ffc/68747470733a2f2f6170692e7472617669732d63692e6f72672f4564656e2d5048502f5365727665722e737667)](https://travis-ci.org/Eden-PHP/Server)
========================================================================================================================================================================================================================================================

[](#)

- [Install](#install)
- [Introduction](#intro)
- [API](#api)
    - [add](#add)
    - [all](#all)
    - [child](#child)
    - [delete](#delete)
    - [error](#error)
    - [get](#get)
    - [getRequest](#getRequest)
    - [getResponse](#getResponse)
    - [getParent](#getParent)
    - [output](#output)
    - [post](#post)
    - [process](#process)
    - [put](#put)
    - [redirect](#redirect)
    - [render](#render)
    - [route](#route)
    - [setParent](#setParent)
    - [success](#success)
- [Contributing](#contributing)

====

Install
-------

[](#install)

`composer install eden/server`

====

Introduction
------------

[](#introduction)

Eden Server is an Express style web service. It allows all kinds of webframeworks to be developed because heavily relies on external middleware. A quick example of this usage is found below.

```
eden('server')
	->route('*', function($request, $response) {
		$response->set('body', 'Hello World!');
	})
	->render();

```

There are 3 kinds of middleware it accepts and are called during specific times during the response process.

### Global Middleware

[](#global-middleware)

Global Middleware are called before any response is generated. Some examples of global middleware can be

- Security - like CSRF checking, Captcha, CORS, HTPASSWD, etc.
- API - like Facebook Login, Paypal, etc.
- Utility - like geoip, localization, internationalization, etc.

You can simply add global middleware in this fashion.

```
eden('server')->add(function($request, $response) {
	$response->set('body', 'Hello World!');
});

```

### Route Middleware

[](#route-middleware)

Route Middleware are called when the request is formed right after the Global Middleware. To make a route available you will need the request method, desired route path and the callback handler.

You can simply add route middleware in this fashion.

```
eden('server')->route('POST', '/some/path/*/foo', function($request, $response) {
	$response->set('body', 'Hello World!');
});

```

Routes can accept dynamic variables denoted as `*`, described in the example route `/some/path/*/foo`. These variables are accessable by calling `$id = $request->get('variables', 0);` in your route handler callback. If your route is using a common request method like `POST`, `GET`, `PUT`, `DELETE`, there are wrapper methods recommended to use instead.

```
eden('server')->post('/some/path/*/foo', function($request, $response) {
	$response->set('body', 'Hello World!');
});

```

```
eden('server')->get('/some/path/*/foo', function($request, $response) {
	$response->set('body', 'Hello World!');
});

```

```
eden('server')->put('/some/path/*/foo', function($request, $response) {
	$response->set('body', 'Hello World!');
});

```

```
eden('server')->delete('/some/path/*/foo', function($request, $response) {
	$response->set('body', 'Hello World!');
});

```

For all the above methods you can also set the response by returning the string like below.

```
eden('server')->get('/some/path/*/foo', function($request, $response) {
	return 'Hello World';
});

```

### Error Middleware

[](#error-middleware)

Error Middleware are called when either the Global or the Route Middleware throws an Exception. You can simply add an error middleware in this fashion.

```
eden('server')->error(function(
		$request,
		$response,
		$type,
		$level,
		$class,
		$file,
		$line,
		$message
	) {
		$response->set('body', 'Hello World!');
	});

```

====

API
---

[](#api)

====

### add

[](#add)

Adds global middleware

#### Usage

[](#usage)

```
eden('server')->add(function $callback);

```

#### Parameters

[](#parameters)

- `function $callback` - The middleware handler

Returns `Eden\Server\Index`

#### Example

[](#example)

```
eden('server')->add(function($request, $response) {
	$response->set('body', 'Hello World!');
});

```

====

### all

[](#all)

Adds routing middleware for all methods

#### Usage

[](#usage-1)

```
eden('server')->all(string $path, function $callback);

```

#### Parameters

[](#parameters-1)

- `string $path` - The route path
- `function $callback` - The middleware handler

Returns `Eden\Server\Index`

#### Example

[](#example-1)

```
eden('server')->all('/some/*/path', function($request, $response) {
	$response->set('body', 'Hello World!');
});

```

====

### child

[](#child)

Returns a new instance with the same configuration

#### Usage

[](#usage-2)

```
eden('server')->child();

```

#### Parameters

[](#parameters-2)

Returns `Eden\Server\Index`

====

### delete

[](#delete)

Adds routing middleware for delete method

#### Usage

[](#usage-3)

```
eden('server')->delete(string $path, function $callback);

```

#### Parameters

[](#parameters-3)

- `string $path` - The route path
- `function $callback` - The middleware handler

Returns `Eden\Server\Index`

#### Example

[](#example-2)

```
eden('server')->delete('/some/*/path', function($request, $response) {
	$response->set('body', 'Hello World!');
});

```

====

### error

[](#error)

Adds error middleware

#### Usage

[](#usage-4)

```
eden('server')->error(function $callback);

```

#### Parameters

[](#parameters-4)

- `function $callback` - The middleware handler

Returns `Eden\Server\Index`

#### Example

[](#example-3)

```
eden('server')->error('/some/*/path', function($request, $response) {
	$response->set('body', 'Hello World!');
});

```

====

### get

[](#get)

Adds routing middleware for get method

#### Usage

[](#usage-5)

```
eden('server')->get(string $path, function $callback);

```

#### Parameters

[](#parameters-5)

- `string $path` - The route path
- `function $callback` - The middleware handler

Returns `Eden\Server\Index`

#### Example

[](#example-4)

```
eden('server')->get('/some/*/path', function($request, $response) {
	$response->set('body', 'Hello World!');
});

```

====

### getRequest

[](#getrequest)

Returns a request object

#### Usage

[](#usage-6)

```
eden('server')->getRequest();

```

#### Parameters

[](#parameters-6)

Returns `Eden\Registry\Index`

====

### getResponse

[](#getresponse)

Returns a response object

#### Usage

[](#usage-7)

```
eden('server')->getResponse();

```

#### Parameters

[](#parameters-7)

Returns `Eden\Registry\Index`

====

### getParent

[](#getparent)

Returns the parent server

#### Usage

[](#usage-8)

```
eden('server')->getParent();

```

#### Parameters

[](#parameters-8)

Returns `Eden\Server\Index`

====

### output

[](#output)

Evaluates the response in order to determine the output. Then of course, output it

#### Usage

[](#usage-9)

```
eden('server')->output(Eden\Registry\Index $response);

```

#### Parameters

[](#parameters-9)

- `Eden\Registry\Index $response` - The response object to evaluate

Returns `Eden\Server\Index`

#### Example

[](#example-5)

```
eden('server')->output($response);

```

====

### post

[](#post)

Adds routing middleware for post method

#### Usage

[](#usage-10)

```
eden('server')->post(string $path, function $callback);

```

#### Parameters

[](#parameters-10)

- `string $path` - The route path
- `function $callback` - The middleware handler

Returns `Eden\Server\Index`

#### Example

[](#example-6)

```
eden('server')->post('/some/*/path', function($request, $response) {
	$response->set('body', 'Hello World!');
});

```

====

### process

[](#process)

Starts to process the request

#### Usage

[](#usage-11)

```
eden('server')->process();

```

#### Parameters

[](#parameters-11)

Returns `array` - with request and response inside

====

### put

[](#put)

Adds routing middleware for put method

#### Usage

[](#usage-12)

```
eden('server')->put(string $path, function $callback);

```

#### Parameters

[](#parameters-12)

- `string $path` - The route path
- `function $callback` - The middleware handler

Returns `Eden\Server\Index`

#### Example

[](#example-7)

```
eden('server')->put('/some/*/path', function($request, $response) {
	$response->set('body', 'Hello World!');
});

```

====

### redirect

[](#redirect)

Browser redirect

#### Usage

[](#usage-13)

```
eden('server')->redirect(string $path);

```

#### Parameters

[](#parameters-13)

- `string $path` - Where to redirect to

Returns `mixed`

#### Example

[](#example-8)

```
eden('server')->redirect();

```

====

### render

[](#render)

Process and output

#### Usage

[](#usage-14)

```
eden('server')->render();

```

#### Parameters

[](#parameters-14)

Returns `Eden\Server\Index`

====

### route

[](#route)

Adds routing middleware

#### Usage

[](#usage-15)

```
eden('server')->route(string $method, string $path, function $callback);

```

#### Parameters

[](#parameters-15)

- `string $method` - The request method
- `string $path` - The route path
- `function $callback` - The middleware handler

Returns `Eden\Server\Index`

#### Example

[](#example-9)

```
eden('server')->route('POST', '/some/*/path', function($request, $response) {
	$response->set('body', 'Hello World!');
});

```

====

### setParent

[](#setparent)

Returns if we were able to output something

#### Usage

[](#usage-16)

```
eden('server')->setParent(Eden\Server\Index $parent);

```

#### Parameters

[](#parameters-16)

- `Eden\Server\Index $parent` - The parent server

Returns `Eden\Server\Index`

#### Example

[](#example-10)

```
eden('server')->setParent($parent);

```

====

### success

[](#success)

Returns if we were able to output something

#### Usage

[](#usage-17)

```
eden('server')->success();

```

#### Parameters

[](#parameters-17)

Returns `bool`

====

\#Contributing to Eden

Contributions to *Eden* are following the Github work flow. Please read up before contributing.

\##Setting up your machine with the Eden repository and your fork

1. Fork the repository
2. Fire up your local terminal create a new branch from the `v4` branch of your fork with a branch name describing what your changes are. Possible branch name types:
    - bugfix
    - feature
    - improvement
3. Make your changes. Always make sure to sign-off (-s) on all commits made (git commit -s -m "Commit message")

\##Making pull requests

1. Please ensure to run `phpunit` before making a pull request.
2. Push your code to your remote forked version.
3. Go back to your forked version on GitHub and submit a pull request.
4. An Eden developer will review your code and merge it in when it has been classified as suitable.

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~12 days

Total

4

Last Release

3886d ago

PHP version history (2 changes)v4.0.0PHP &gt;=5.3.1

4.0.1PHP &gt;=5.4.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/120378?v=4)[Christian Blanquera](/maintainers/cblanquera)[@cblanquera](https://github.com/cblanquera)

---

Top Contributors

[![clark21](https://avatars.githubusercontent.com/u/5639521?v=4)](https://github.com/clark21 "clark21 (5 commits)")

---

Tags

libraryeden

### Embed Badge

![Health badge](/badges/eden-server/health.svg)

```
[![Health](https://phpackages.com/badges/eden-server/health.svg)](https://phpackages.com/packages/eden-server)
```

###  Alternatives

[eden/mail

Eden POP3, IMAP and SMTP component

179276.6k1](/packages/eden-mail)[ikilobyte/pulsar-client-php

PHP Native Client library for Apache Pulsar

59130.5k1](/packages/ikilobyte-pulsar-client-php)[eden/sqlite

Eden SQLite Search, Collection, Model ORM componen

199.2k2](/packages/eden-sqlite)[ecentria/ecentria-rest-bundle

Goal of this bundle is to simplify process of creating APIs with Symfony. We use already well-coded libraries, combine them together to simplify process and not to re-invent the wheel. We've chose REST and HATEOS to have unified standards of API requests and responses.

142.4k](/packages/ecentria-ecentria-rest-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
