Download the PHP package mitchdav/laravel-versioned-api without Composer

On this page you can find all versions of the php package mitchdav/laravel-versioned-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-versioned-api

Laravel Versioned API

This is a skeleton for the Laravel framework which takes care of setting up a new project with Doctrine, Dingo and JWT. 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

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

Make a POST request to with set to . 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 header as follows:

Authorization: Bearer {token}

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

{
    "id": 1,
    "email": "[email protected]",
    "name": "Dillon Effertz",
    "job": "Roofer"
}

For further information about making requests to the server check the Dingo API Wiki.

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 for your versions are available by looking at the routes file.

Adding New Versions

The important files are all contained in the 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 folder and give it a suitable name (for example, copy the folder to )
  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 to within the folder)
  3. Copy any existing routes from the previous version to the new version in the routes file
  4. Update the file to include the new version in the section
  5. Update the file's 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

To remove a version follow this process:

  1. Remove the version's folder inside the folder
  2. Remove the routes for the removed version from the routes file
  3. Remove the entry in the file
  4. Check that the file's variable is not set to the removed version

All versions of laravel-versioned-api with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6.4
laravel/framework Version 5.3.*
laravel-doctrine/orm Version 1.2.*
dingo/api Version 1.0.x@dev
tymon/jwt-auth Version 0.5.*
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package mitchdav/laravel-versioned-api contains the following files

Loading the files please wait ....