PHPackages                             cymbaline/cymbaline - 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. [Framework](/categories/framework)
4. /
5. cymbaline/cymbaline

ActiveFramework[Framework](/categories/framework)

cymbaline/cymbaline
===================

Yet another web service framework in PHP

221PHP

Since Dec 7Pushed 10y ago1 watchersCompare

[ Source](https://github.com/nerandell/cymbaline)[ Packagist](https://packagist.org/packages/cymbaline/cymbaline)[ RSS](/packages/cymbaline-cymbaline/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (1)Used By (0)

cymbaline
=========

[](#cymbaline)

[![https://api.travis-ci.org/nerandell/cymbaline.svg?branch=master](https://camo.githubusercontent.com/a08c129b76ecd7840701cbd71e574e221d996858686071a5112cb2769340fcae/68747470733a2f2f6170692e7472617669732d63692e6f72672f6e6572616e64656c6c2f63796d62616c696e652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/nerandell/cymbaline)

cymbaline is yet another PHP web service framework. It follows MVC pattern and makes development of web applications easy by including commonly used tasks in the framework itself to reduce effort and time taken for development.

Getting Started
---------------

[](#getting-started)

- PHP 5.3.x is required
- Install [Composer](https://getcomposer.org/)
- Setup URL rewriting so that all requests are handled by index.php

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

[](#installation)

- Get Composer
- Require cymbaline with `php composer.phar require cymbaline/cymbaline`
- Add the following to your application's main PHP file: `require 'vendor/autoload.php';`

You can also add the following to an existing `composer.json` file : `"cymbaline/cymbaline": "*"`. A sample `composer.json` would look like this:

```
{
    "name": "cymbaline/cymbaline_demo",
    "description": "Demo for using cymbaline",
    "authors": [
        {
            "name": "Ankit Chandawala",
            "email": "ankitchandawala@gmail.com"
        }
    ],
    "require": {
        "cymbaline/cymbaline": "@dev"
    },
    "minimum-stability": "dev"
}
```

`cymbaline` requires several libraries to work.

- [Klein](https://github.com/chriso/klein.php) is used for routing.
- It uses [Eloquent](http://laravel.com/docs/5.0/eloquent) to work with your databases.
- [Twig](http://twig.sensiolabs.org/) is used as a templating engine for rendering views.

Usage
-----

[](#usage)

To see a sample app, you can check a simple demo [here](https://github.com/nerandell/cymbaline_demo).

Once `cymbaline` is installed, start routing all your requests to `index.php`. Here is a sample nginx configuration to route the requests

```
location / {
            try_files $uri $uri/ /index.php;
            root   /path_to_your_root_dir;
            index  index.html index.htm index.php;
        }
```

Add the following lines to our `index.php` file : `require 'vendor/autoload.php';`

`cymbaline` is based on [MVC](https://msdn.microsoft.com/en-us/library/ff649643.aspx) design pattern. You can start defining your models, controllers and views and `cymbaline` will stitch it all for you using short and concise code to reduce the development times needed while building a web application.

You app code should reside in top-level directory named `app`. Then you can start adding your models, contollers and views. Typically your directory structure would look like this:

```
app
├── config
│   └── database.php
├── controllers
│   ├── CompanyController.php
│   └── UserController.php
├── models
│   ├── Company.php
│   └── User.php
├── routes.php
└── views
    └── index.html
```

The models that you define reside in the `app/models` directory. To create a model, you have to extend from `BaseModel` class which is provided by `cymbaline`

```
use Cymbaline\BaseModel;

class User extends BaseModel
{

}
```

`BaseModel` internally uses `Model` class from `Eloquent` and same options are available for configuration. Check out Eloquent [documentation](http://laravel.com/docs/5.1/eloquent)for more information.

`cymbaline` picks up your database configuration from `config/database.php`. Your database file will look like this:

```
