PHPackages                             smhdhsn/zed - 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. smhdhsn/zed

ActiveProject[API Development](/categories/api)

smhdhsn/zed
===========

ZED is an API-Based Micro-Framework powered by PHP.

v1.0.6(4y ago)721[2 issues](https://github.com/SMhdHsn/zed/issues)MITPHP

Since Aug 31Pushed 4y ago1 watchersCompare

[ Source](https://github.com/SMhdHsn/zed)[ Packagist](https://packagist.org/packages/smhdhsn/zed)[ RSS](/packages/smhdhsn-zed/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (2)Versions (17)Used By (0)

 [![](https://raw.githubusercontent.com/SMhdHsn/SMhdHsn/master/Assets/Images/zed_logo.jpeg "Brainsss...!")](https://raw.githubusercontent.com/SMhdHsn/SMhdHsn/master/Assets/Images/zed_logo.jpeg)

About
-----

[](#about)

ZED is an API-Based Micro-Framework powered by PHP.

### Features

[](#features)

- ORM.
- Routing.
- Migration.
- Command.
- Request Validation.

Getting started
---------------

[](#getting-started)

Make sure you have `composer` installed in your machine and then create a new ZED project using composer:

```
composer create-project smhdhsn/zed ProjectName
```

After the application has been created, you may start ZED's local development server using command line:

```
php command serve
```

You can provide a custom port to serve on like the following:

```
php command serve --port=8080
```

Documentation
-------------

[](#documentation)

### Routing

[](#routing)

#### Defining routes

[](#defining-routes)

You can choose between three options for defining a route for your application.

#### Via closure

[](#via-closure)

```
$router->get('/projects', function () {
    return 'Hello, World !';
});
```

#### Via string

[](#via-string)

```
$router->get('/projects', 'ProjectController@index');
```

#### Via array

[](#via-array)

```
use App\Controllers\ProjectController;

$router->get('/projects', [ProjectController::class, 'index']);
```

### Middleware

[](#middleware)

You can implement a middleware to a route like the following.

```
$router->get('/project/:projectId', 'ProjectController@show', [
    'checkAvailability'
]);
```

> ℹ️ You need to list the method name that is responsible for your middleware inside the array.

### Protecting routes

[](#protecting-routes)

As I mentioned before, you can provide middleware within an array as the third parameter to the route.

```
$router->get('/project/:projectId', 'ProjectController@show', [
    'auth'
]);
```

> ℹ️ The auth middleware is powered by JWT and is responsible for protecting routes from unauthenticated requests.

### Route params

[](#route-params)

You may wish to pass your route parameters to your application. You may do so like the following.

```
$router->get('/projects/:projectId/logs/:logId', 'ProjectController@index');
```

> ℹ️ In your controller or closure you'll receive Request object as your first parameter.

```
