https://github.com/ethercreative/yii2-app-api
Yii 2 RESTful API Template
https://github.com/ethercreative/yii2-app-api
Last synced: 13 days ago
JSON representation
Yii 2 RESTful API Template
- Host: GitHub
- URL: https://github.com/ethercreative/yii2-app-api
- Owner: ethercreative
- License: mit
- Created: 2016-05-19T13:10:29.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2018-09-19T11:42:53.000Z (over 7 years ago)
- Last Synced: 2025-12-09T23:53:20.339Z (4 months ago)
- Language: PHP
- Size: 30.3 KB
- Stars: 8
- Watchers: 0
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Yii 2 API Project Template
============================
REQUIREMENTS
------------
The minimum requirement by this project template that your Web server supports PHP 5.4.0.
INSTALLATION
------------
### Install from an Archive File
Extract the archive file downloaded from [github.com](https://github.com/mattether/yii2-app-api/archive/master.zip) to
a directory named `api` that is directly under the Web root.
Set cookie validation key in `config/web.php` file to some random secret string:
```php
'request' => [
// !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
'cookieValidationKey' => '',
],
```
You can then access the application through the following URL:
~~~
http://localhost/api/web/
~~~
### Install via Composer
If you do not have [Composer](http://getcomposer.org/), you may install it by following the instructions
at [getcomposer.org](http://getcomposer.org/doc/00-intro.md#installation-nix).
You can then install this project template using the following command:
~~~
php composer.phar global require "fxp/composer-asset-plugin:~1.1.1"
php composer.phar create-project --prefer-dist --stability=dev ethercreative/yii2-app-api api
~~~
Now you should be able to access the application through the following URL, assuming `api` is the directory
directly under the Web root.
~~~
http://localhost/api/web/
~~~
CONFIGURATION
-------------
### Database
Edit the file `config/db.php` with real data, for example:
```php
return [
'class' => 'yii\db\Connection',
'dsn' => 'mysql:host=localhost;dbname=yii2basic',
'username' => 'root',
'password' => '1234',
'charset' => 'utf8',
];
```
**NOTES:**
- Yii won't create the database for you, this has to be done manually before you can access it.
- Check and edit the other files in the `config/` directory to customize your application as required.
- Refer to the README in the `tests` directory for information specific to basic application tests.