PHPackages                             ggedde/spry - 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. ggedde/spry

ActiveFramework[API Development](/categories/api)

ggedde/spry
===========

PHP API Framework

1.1.11(5y ago)6118MITPHP &gt;=5.5.0

Since Jul 12Pushed 5y ago1 watchersCompare

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

READMEChangelog (10)Dependencies (9)Versions (53)Used By (0)

Spry
====

[](#spry)

A lightweight PHP API Framework
Great for CRUD applications

[![GitHub release (latest by date including pre-releases)](https://camo.githubusercontent.com/bfe41d061690be8d4832453a91c811c0f84f257e047622284e63f4b2362cc641/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f6767656464652f737072793f696e636c7564655f70726572656c6561736573)](https://camo.githubusercontent.com/bfe41d061690be8d4832453a91c811c0f84f257e047622284e63f4b2362cc641/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f6767656464652f737072793f696e636c7564655f70726572656c6561736573) [![GitHub](https://camo.githubusercontent.com/5b73d68986fc9f7be835d6311ea2b279f77071f0063d7eca847f0daec2e38c3e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6767656464652f737072793f6c6162656c3d6c6963656e7365)](https://camo.githubusercontent.com/5b73d68986fc9f7be835d6311ea2b279f77071f0063d7eca847f0daec2e38c3e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6767656464652f737072793f6c6162656c3d6c6963656e7365) [![PHP from Packagist](https://camo.githubusercontent.com/6d4eec3a32c8c50a6628e780c7102e7d68d07e1f3b656677706d46c7578c25d5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6767656464652f73707279)](https://camo.githubusercontent.com/6d4eec3a32c8c50a6628e780c7102e7d68d07e1f3b656677706d46c7578c25d5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6767656464652f73707279)

@PSR2 and @Symfony Compliant

Documentation
=============

[](#documentation)

- [Installation](#Installation)
- [Quick Start](#QuickStart)
- [Configuration](#Configuration)
- [Components](#Components)
- [Routes](#Routes)
- [Database](#Database)
- [Logger](#Logger)
- [Response](#Response)
- [Response Codes](#ResponseCodes)
- [Tests](#Tests)
- [Rate Limits](#RateLimits)
- [Lifecycle Hooks &amp; Filters (Middleware)](#Lifecycle)
- [Todos](#Todos)

Installation
============

[](#installation)

The best way to install Spry and use it is through the CLI.

```
composer global require ggedde/spry-cli

```

Please reference the [Installation Process](https://github.com/ggedde/spry-cli#installation) on the CLI Page.
Then from the command line:

```
spry new [project_name]
cd [project_name]

```

An enpoint is automatically created for you

public/index.php

```
include dirname(__DIR__).'/vendor/autoload.php';
include dirname(__DIR__).'/spry/init.php';
```

Manual Installation
-------------------

[](#manual-installation)

```
composer require ggedde/spry

```

You will need to add the composer autoloader if it has not already been added. Then use the `run` method and include a path to your config file or include a config object. See [configuration](#Configuration)

Example:

```
include_once '/vendor/autoload.php';
Spry\Spry::run('../config.php');
```

QuickStart
==========

[](#quickstart)

### Create a project through the CLI

[](#create-a-project-through-the-cli)

```
spry new [project_name]
cd [project_name]

```

### Folder Structure

[](#folder-structure)

```
- public/
    index.php
- spry/
    - components/
    - logs/
        - api.log
        - php.log
    - config.php
    - init.php

```

#### To Start the Spry test server run

[](#to-start-the-spry-test-server-run)

```
spry up

```

#### Then open a *separate* termal and run some tests

[](#then-open-a-separate-termal-and-run-some-tests)

```
spry test

```

#### Create a Single FIle Component

[](#create-a-single-file-component)

```
spry component MyComponent

```

*Now View and Edit `spry/components/MyComponent.php`*

#### Update Database Schema from New Component to Database

[](#update-database-schema-from-new-component-to-database)

```
spry migrate

```

#### Run Tests again with new Component

[](#run-tests-again-with-new-component)

```
spry test

```

Thats It!
Happy Coding

Well, I guess you might need more info. Most of all your coding will be in the components files you create and the rest will most likely be in the configuration file. See more details below :)

Configuration
=============

[](#configuration)

Spry requires a config file or a config object.

When using a config file Spry will pass a pre-initialized $config object to the file. You will just need to set the variables within the object

Example Config File:

```
