PHPackages                             php-resta/skeleton - 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. php-resta/skeleton

ActiveLibrary[Framework](/categories/framework)

php-resta/skeleton
==================

resta php api restfull framework

v1.0.0(7y ago)081MITPHPCI failing

Since Apr 20Pushed 5y agoCompare

[ Source](https://github.com/php-resta/skeleton)[ Packagist](https://packagist.org/packages/php-resta/skeleton)[ Docs](https://github.com/aligurbuz/resta)[ RSS](/packages/php-resta-skeleton/feed)WikiDiscussions master Synced 6d ago

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

[![Build Status](https://camo.githubusercontent.com/775cedae45f3f211897054540ddb71446187451c3ae21f4101c032b41778c61a/68747470733a2f2f7472617669732d63692e6f72672f616c6967757262757a2f72657374612e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/aligurbuz/resta)[![Total Downloads](https://camo.githubusercontent.com/751247cfd311b454c7a1d330f85fb261f97121256c616d0a8f1d334e330c7655/68747470733a2f2f706f7365722e707567782e6f72672f72657374617069782f72657374612f646f776e6c6f616473)](https://packagist.org/packages/restapix/resta)[![License](https://camo.githubusercontent.com/35881c55ce69564b25141d081f1b85caa4fb05992ba52765e03b5284875de245/68747470733a2f2f706f7365722e707567782e6f72672f72657374617069782f72657374612f6c6963656e7365)](https://packagist.org/packages/restapix/resta)[![Latest Unstable Version](https://camo.githubusercontent.com/1e8c2a73472ed28ba44fa33ef448b8813417556a494438fcebde24074fe90fd0/68747470733a2f2f706f7365722e707567782e6f72672f72657374617069782f72657374612f762f756e737461626c65)](//packagist.org/packages/restapix/resta)

Resta Api Structure
===================

[](#resta-api-structure)

Developing restfull(presentational) api with php has never been so enjoyable.. We are claiming.You will so love this structure. Slogan :  If the machine can make itself the code that you write, do not write it.You can contact me if you want to be contributor in the core of the resta.We need you for a better stable core. Resta api offers the ideal structure for your application and gives you great pleasure in writing code.

Developments are still in progress. The documentation section of the code will be available in beta soon.

What are the features of the Resta?
-----------------------------------

[](#what-are-the-features-of-the-resta)

- Very powerful console generator structure
- Published documentation for each api endpoint.
- Supported component integrity
- Excellent comfort support
- Easy and fast manageability.
- Eloquent or Doctrine Option
- Excellent model migration relationship
- A very stable exception management
- A manageable versioning capsule
- Ide friendly annotation system
- Multiple supported project management
- Interchangeable core structure

Resta Quick Start
=================

[](#resta-quick-start)

If you want to have a quick start to resta. Just take a look at this short document. You will need to install it first, as with any framework or package. We need a composer installer to install the resta api. If you don't have a composer installer, please [composer](https://getcomposer.org/download)Check out this link.

How to install the resta?
-------------------------

[](#how-to-install-the-resta)

```
$ composer create-project php-resta/skeleton company_name dev-master
```

> **company\_name:** The directory to which you will install the resta api is generally a group name that is valid for your company name or projects.Thus, your api projects will be in this general directory.

Your resta skeleton structure is now ready.

```
$ cd company_name
```

You can pass to the home directory of your project using the terminal command.

Create your first project.
--------------------------

[](#create-your-first-project)

Now it's time to create our project.Your project will be created in the src/app directory.Let's create a project named demo with the command below.

```
$ php api project create demo
```

If you get a response similar to the following, Oh! Excellent. You now have a new project called demo.

```
$  > Application called as "Demo" has been successfully created in the /path/company_name/src/app/Demo/
```

Your project is located in the directory called src/app/Demo. Below you can see the structure of your project.

```
Demo/
|
|- Api/
|  |- V1/
|     |- Config/
|        |- App.php
|        |- Authenticate.php
|        |- AutoServices.php
|        |- Cache.php
|        |- Database.php
|        |- Hateoas.php
|        |- Redis.php
|        |- Slack.php
|     |- Middleware/
|        |- Authenticate.php
|        |- ClientApiToken.php
|        |- RateLimit.php
|        |- SetClientTimezone.php
|        |- TrustedProxies.php
|     |- ServiceAnnotationsManager.php
|     |- ServiceEventDispatcherManager.php
|     |- ServiceLogManager.php
|     |- ServiceMiddlewareManager.php
|
|- Kernel/
|  |- Node/
|     |- index.html
|  |- Providers/
|     |- AppServiceProvider.php
|     |- ConsoleEventServiceProvider.php
|     |- RouteServiceProvider.php
|  |- Stub/
|     |- index.html
|  |- Kernel.php
|  |- Version.php
|
|- Storage/
|  |- Language
|  |- Log
|  |- Resource
|  |- index.html
|
|- Tests/
|  |- index.html
|
|- Webservice/
|  |- index.html
|
|- .gitignore
|- composer.json
|- README.md

```

This project structure is created by default with each project command.You can find out how to customize this structure in documents. Since this section is a quick start, we won't write here what these directory structures do. We'll just show you how to quickly reach your endpoints.

Access your endpoints with the browser.
---------------------------------------

[](#access-your-endpoints-with-the-browser)

```
http://localhost/company_name/public/demo

```

Now open your browser and enter the above address via localhost or ip. As mentioned earlier, the directory where you create the resta skeleton repository structure will be your company\_name name.

```
{
"meta": {
"success": false,
"status": 401,
"illuminator": null
},
"resource": {
"errorMessage": "No Endpoint"
}
}

```

Congratulations! You took the first exception output :). Don't worry, you haven't done anything yet.

Create your first controller structure.
---------------------------------------

[](#create-your-first-controller-structure)

```
$ php api controller create demo controller:users
```

Then let's create our first endpoint.Try creating your first controller with the command above.

```
$  > Controller called as "Users" has been successfully created in the /path/company_name/src/app/Demo/Api/V1/Controllers
```

Great! Your first controller has been successfully created. Now you'll see a controller directory created by looking into the V1 directory. We will not describe the structure in this directory in this section. You will already find detailed information in our documents.

```
http://localhost/company_name/public/demo/users
http://localhost/company_name/public/demo/v1/users //the same as the above request.

```

Now open your browser again and change the URL string that you specified with the demo to demo/users and send the request.

```
{
"meta": {
"success": true,
"status": 200,
"illuminator": null
},
"resource": {
"endpoint": "Users"
}
}

```

This is great! We now have the first http 200 output.By default the system produces you json.You can find in our documentation how to change it. This output is called as endpoint "users" and has a class as UsersController in the "Users" directory.

```
