Download the PHP package sganz/yii2-advanced-api-template without Composer

On this page you can find all versions of the php package sganz/yii2-advanced-api-template. 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 yii2-advanced-api-template

yii2-advanced-api-template

Yii2-advanced-template is based on yii2-app-advanced created by yii2 core developers. That being said the yii2-advanced-api-template is based on the yii2-advanced-template.

There are several upgrades made to this template, including both Nenand's and Sandy's changes

  1. Support for an off webroot API application that can be used for a service layer or what ever you might want to call it. It has no view configuration.
  2. This template has additional features listed in the next section of this guide.
  3. Application structure has been changed to be 'shared hosting friendly'.
  4. Added example modules and set up for REST as well as simple ajax api like calls with versions of the API (Via Modules and Routing)

Features (Most From Yii2-advanced-template)

Installation

I am assuming that you know how to: install and use Composer, and install additional packages/drivers that may be needed for you to run everything on your system. In case you are new to all of this, you can check my guides for installing default yii2 application templates, provided by yii2 developers, on Windows 8 and Ubuntu based Linux operating systems, posted on www.freetuts.org.

  1. Create database that you are going to use for your application (you can use phpMyAdmin or any other tool you like).

  2. Now open up your console and to your web root directory, for example:

  3. Run the Composer command:

  4. Once template is downloaded, you need to initialize it in one of two environments: development (dev) or production (prod). Change your working directory to and execute command.

    Type 0 for development, execute coomand, type yes to confirm, and execute again.

  5. Now you need to tell your application to use database that you have previously created. Open up main-local.php config file in and adjust your connection credentials.

  6. Back to the console. It is time to run yii migrations that will create necessary tables in our database. While you are inside folder execute :

    or if you are on Windows

  7. Execute rbac controller init action that will populate our rbac tables with default roles and permissions:

    or if you are on Windows

You are done, you can start your application in your browser.

*Tip: if your application name is, for example, advanced, to see the frontend side of it you just have to visit this url in local host: . To see backend side, this is enough: .

Note: First user that signs up will get 'The Creator' (super admin) role. This is supposed to be you. This role have all possible super powers :) . Every other user that signs up after the first one will get 'member' role. Member is just normal authenticated user.

Testing

If you want to run tests you should create additional database that will be used to store your testing data. Usually testing database will have the same structure like the production one. I am assuming that you have Codeception installed globally, and that you know how to use it. Here is how you can set up everything easily:

  1. Let's say that you have created database called . Go create the testing one called .

  2. Inside your config file change database you are going to use to .

  3. Open up your console and to the folder of your application.

  4. Run the migrations again: or if you are on Windows

  5. Run rbac/init again: or if you are on Windows

  6. Now you can tell your application to use your database again instead of . Adjust your config file again.

  7. Now you are ready to tell Codeception to use database.

    Inside: file tell your to use database.

  8. Start your php server inside the root of your application: (if the name of your application is advanced, then root is folder)

  9. To run tests written for frontend side of your application to , run and then run your tests.

  10. Take similar steps like in step 9 for backend and common tests.

Directory structure

Comments

Built from From v2.2.0 of yii-advanced-template. Added some examples for Rest API and simple controllers with some versions of the controller. The original is from https://github.com/nenad-zivkovic/yii2-advanced-template specific examples from Nenad Zivkovic can be found if you poke around his github page.

The example code for the 'country' REST calls require a table in your DB to work. Put this in what ever DB you are activly connected to.

The sql for the test table for countries is -

This was from a nice simple intro to yii2 and restfull controllers at - http://budiirawan.com/setup-restful-api-yii2

Licensing

My work (Sandy Ganz) is licenced as WTFPL, which is NOT true for the original work which should remain as Nenad Zivkovic and possibly YiiSoft Licensed it.

WTFPL Yii2


All versions of yii2-advanced-api-template with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
yiisoft/yii2 Version *
yiisoft/yii2-bootstrap Version *
yiisoft/yii2-swiftmailer Version *
nenad/yii2-password-strength Version *
mihaildev/yii2-ckeditor Version *
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 sganz/yii2-advanced-api-template contains the following files

Loading the files please wait ....