PHPackages                             mitchdav/laravel-versioned-api - 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. mitchdav/laravel-versioned-api

AbandonedArchivedProject[Framework](/categories/framework)

mitchdav/laravel-versioned-api
==============================

A basic starter skeleton for working with versioned APIs using Laravel 5.3, Doctrine 2, Dingo 1.0 and JWT 0.5.

0.2.0(9y ago)21498[1 issues](https://github.com/mitchdav/laravel-versioned-api/issues)MITPHPPHP &gt;=5.6.4

Since Oct 29Pushed 8y ago3 watchersCompare

[ Source](https://github.com/mitchdav/laravel-versioned-api)[ Packagist](https://packagist.org/packages/mitchdav/laravel-versioned-api)[ RSS](/packages/mitchdav-laravel-versioned-api/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (9)Versions (5)Used By (0)

Laravel Versioned API
=====================

[](#laravel-versioned-api)

This is a skeleton for the [Laravel](https://laravel.com/) framework which takes care of setting up a new project with [Doctrine](http://www.laraveldoctrine.org/), [Dingo](https://github.com/dingo/api) and [JWT](https://github.com/tymondesigns/jwt-auth). After installation you will have a working REST API which responds to requests for 3 different versions of the same API, and has authentication already built-in.

Requirements
------------

[](#requirements)

- PHP &gt;= 5.6.4
- A database (MySQL, or any others supported by Laravel and Doctrine)
- [Composer](https://getcomposer.org/).

Dependencies
------------

[](#dependencies)

You have two options to get the skeleton setup:

1. Utilise Composer's create-project command by running the following command in the terminal:

    ```
     composer create-project mitchdav/laravel-versioned-api

    ```
2. Or clone the repo manually by running the following commands in the terminal:

    ```
     git clone https://github.com/mitchdav/laravel-versioned-api.git
     cd laravel-versioned-api
     composer install
     php -r "copy('.env.example', '.env');"
     php artisan key:generate
     php artisan jwt:generate

    ```

This will setup the project's dependencies, however you will still need to setup the database. You must first create a MySQL database, and then store its details in the .env file like so:

```
DB_DATABASE=mydatabase
DB_USERNAME=root
DB_PASSWORD=

```

To then setup the database we use Doctrine's helper command to build our schema and proxies.

```
php artisan doctrine:schema:create
php artisan doctrine:generate:proxies

```

The system is now ready to receive requests made against it, however we don't have any users to login to the API with. To generate a test user, run the following command:

```
php artisan db:seed

```

This will output an email address and password you can use to login.

Logging In
----------

[](#logging-in)

Make a POST request to `/auth/authenticate` with `Content-Type` set to `application/json`. The JSON structure should look like the following:

```
{
    "email": "{email address from previous command}",
    "password": "{password from previous command}"
}

```

If the response is successful, you will receive a token which you can use to make subsequent requests to the server, while remaining authenticated as the given user. To send through the token value send it in the `Authorization` header as follows:

```
Authorization: Bearer {token}

```

To retrieve the user details make a GET request to `/auth/me` and you will receive a request similar to the following:

```
{
    "id": 1,
    "email": "theodora39@example.net",
    "name": "Dillon Effertz",
    "job": "Roofer"
}

```

For further information about making requests to the server check the [Dingo API Wiki](https://github.com/dingo/api/wiki).

Developing The Server
---------------------

[](#developing-the-server)

As you make changes to the entities, you need to generate proxies for your entities, so that the system can load quickly for each request. To do this, run the following command in the terminal:

```
php artisan doctrine:generate:proxies

```

This will not be necessary unless you modify the entities as their proxies are already generated and committed.

If your changes to an entity modify its database structure, you can persist this to the database by running the following command in the terminal:

```
php artisan doctrine:schema:update

```

Routes
------

[](#routes)

Routes for your versions are available by looking at the [routes file](https://github.com/mitchdav/laravel-versioned-api/blob/master/app/Http/routes.php).

Adding New Versions
-------------------

[](#adding-new-versions)

The important files are all contained in the `app/API` folder. The project has 3 different versions of the same API, which is kept very simple to be as extendable as possible.

When you would like to add a new version, you will need to follow this process:

1. Copy the whole previous version's folder into the `app/API` folder and give it a suitable name (for example, copy the `app/API/V3` folder to `app/API/V4`)
2. Do a search and replace operation to update the folder's references from the previous version to the new version (for example, update all instances of `V3` to `V4` within the `V4` folder)
3. Copy any existing routes from the previous version to the new version in the routes file
4. Update the `config/api.php` file to include the new version in the `auth` section
5. Update the `.env` file's `API_VERSION` variable to the new version
6. Make your changes to the API's new version (for example, add a new entity, or a field to an existing entity)
7. Run the following commands to update the database schema and proxies

    ```
     php artisan doctrine:generate:proxies
     php artisan doctrine:schema:update

    ```
8. Add routes to any new endpoints in the routes file

Removing Versions
-----------------

[](#removing-versions)

To remove a version follow this process:

1. Remove the version's folder inside the `app/API` folder
2. Remove the routes for the removed version from the routes file
3. Remove the `auth` entry in the `config/api.php` file
4. Check that the `.env` file's `API_VERSION` variable is not set to the removed version

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 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 ~0 days

Total

4

Last Release

3478d ago

PHP version history (2 changes)0.1.0PHP &gt;=5.5.9

0.2.0PHP &gt;=5.6.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/12d90228bd4fe97ca6509022b1933a49ff1eb86f5699e04c5aadd1cd160bbb07?d=identicon)[mitchdav](/maintainers/mitchdav)

---

Top Contributors

[![mitchdav](https://avatars.githubusercontent.com/u/3215585?v=4)](https://github.com/mitchdav "mitchdav (10 commits)")

---

Tags

jwtapiframeworklaravelrestdoctrineSkeletonversioneddingo

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mitchdav-laravel-versioned-api/health.svg)

```
[![Health](https://phpackages.com/badges/mitchdav-laravel-versioned-api/health.svg)](https://phpackages.com/packages/mitchdav-laravel-versioned-api)
```

###  Alternatives

[francescomalatesta/laravel-api-boilerplate-jwt

An API Boilerplate to create a ready-to-use REST API in seconds.

1.2k7.5k](/packages/francescomalatesta-laravel-api-boilerplate-jwt)

PHPackages © 2026

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