Skip to content

Commit 36729ce

Browse files
author
Leonardo Caballero
committed
Initial commit
0 parents  commit 36729ce

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+3018
-0
lines changed

.bowerrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"directory" : "vendor/bower"
3+
}

.gitignore

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# phpstorm project files
2+
.idea
3+
4+
# netbeans project files
5+
nbproject
6+
7+
# zend studio for eclipse project files
8+
.buildpath
9+
.project
10+
.settings
11+
12+
# windows thumbnail cache
13+
Thumbs.db
14+
15+
# composer vendor dir
16+
/vendor
17+
18+
# composer itself is not needed
19+
composer.phar
20+
21+
# Mac DS_Store Files
22+
.DS_Store
23+
24+
# phpunit itself is not needed
25+
phpunit.phar
26+
# local phpunit config
27+
/phpunit.xml

LICENSE.md

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
The Yii framework is free software. It is released under the terms of
2+
the following BSD License.
3+
4+
Copyright © 2008 by Yii Software LLC (http://www.yiisoft.com)
5+
All rights reserved.
6+
7+
Redistribution and use in source and binary forms, with or without
8+
modification, are permitted provided that the following conditions
9+
are met:
10+
11+
* Redistributions of source code must retain the above copyright
12+
notice, this list of conditions and the following disclaimer.
13+
* Redistributions in binary form must reproduce the above copyright
14+
notice, this list of conditions and the following disclaimer in
15+
the documentation and/or other materials provided with the
16+
distribution.
17+
* Neither the name of Yii Software LLC nor the names of its
18+
contributors may be used to endorse or promote products derived
19+
from this software without specific prior written permission.
20+
21+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24+
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25+
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27+
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30+
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31+
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32+
POSSIBILITY OF SUCH DAMAGE.

README.md

+101
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
Yii 2 Basic Project Template
2+
============================
3+
4+
Yii 2 Basic Project Template is a skeleton [Yii 2](http://www.yiiframework.com/) application best for
5+
rapidly creating small projects.
6+
7+
The template contains the basic features including user login/logout and a contact page.
8+
It includes all commonly used configurations that would allow you to focus on adding new
9+
features to your application.
10+
11+
[![Latest Stable Version](https://poser.pugx.org/yiisoft/yii2-app-basic/v/stable.png)](https://packagist.org/packages/yiisoft/yii2-app-basic)
12+
[![Total Downloads](https://poser.pugx.org/yiisoft/yii2-app-basic/downloads.png)](https://packagist.org/packages/yiisoft/yii2-app-basic)
13+
[![Build Status](https://travis-ci.org/yiisoft/yii2-app-basic.svg?branch=master)](https://travis-ci.org/yiisoft/yii2-app-basic)
14+
15+
DIRECTORY STRUCTURE
16+
-------------------
17+
18+
assets/ contains assets definition
19+
commands/ contains console commands (controllers)
20+
config/ contains application configurations
21+
controllers/ contains Web controller classes
22+
mail/ contains view files for e-mails
23+
models/ contains model classes
24+
runtime/ contains files generated during runtime
25+
tests/ contains various tests for the basic application
26+
vendor/ contains dependent 3rd-party packages
27+
views/ contains view files for the Web application
28+
web/ contains the entry script and Web resources
29+
30+
31+
32+
REQUIREMENTS
33+
------------
34+
35+
The minimum requirement by this project template that your Web server supports PHP 5.4.0.
36+
37+
38+
INSTALLATION
39+
------------
40+
41+
### Install from an Archive File
42+
43+
Extract the archive file downloaded from [yiiframework.com](http://www.yiiframework.com/download/) to
44+
a directory named `basic` that is directly under the Web root.
45+
46+
Set cookie validation key in `config/web.php` file to some random secret string:
47+
48+
```php
49+
'request' => [
50+
// !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
51+
'cookieValidationKey' => '<secret random string goes here>',
52+
],
53+
```
54+
55+
You can then access the application through the following URL:
56+
57+
~~~
58+
http://localhost/basic/web/
59+
~~~
60+
61+
62+
### Install via Composer
63+
64+
If you do not have [Composer](http://getcomposer.org/), you may install it by following the instructions
65+
at [getcomposer.org](http://getcomposer.org/doc/00-intro.md#installation-nix).
66+
67+
You can then install this project template using the following command:
68+
69+
~~~
70+
php composer.phar global require "fxp/composer-asset-plugin:~1.0.0"
71+
php composer.phar create-project --prefer-dist --stability=dev yiisoft/yii2-app-basic basic
72+
~~~
73+
74+
Now you should be able to access the application through the following URL, assuming `basic` is the directory
75+
directly under the Web root.
76+
77+
~~~
78+
http://localhost/basic/web/
79+
~~~
80+
81+
82+
CONFIGURATION
83+
-------------
84+
85+
### Database
86+
87+
Edit the file `config/db.php` with real data, for example:
88+
89+
```php
90+
return [
91+
'class' => 'yii\db\Connection',
92+
'dsn' => 'mysql:host=localhost;dbname=yii2basic',
93+
'username' => 'root',
94+
'password' => '1234',
95+
'charset' => 'utf8',
96+
];
97+
```
98+
99+
**NOTE:** Yii won't create the database for you, this has to be done manually before you can access it.
100+
101+
Also check and edit the other files in the `config/` directory to customize your application.

assets/AppAsset.php

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
/**
3+
* @link http://www.yiiframework.com/
4+
* @copyright Copyright (c) 2008 Yii Software LLC
5+
* @license http://www.yiiframework.com/license/
6+
*/
7+
8+
namespace app\assets;
9+
10+
use yii\web\AssetBundle;
11+
12+
/**
13+
* @author Qiang Xue <[email protected]>
14+
* @since 2.0
15+
*/
16+
class AppAsset extends AssetBundle
17+
{
18+
public $basePath = '@webroot';
19+
public $baseUrl = '@web';
20+
public $css = [
21+
'css/site.css',
22+
];
23+
public $js = [
24+
];
25+
public $depends = [
26+
'yii\web\YiiAsset',
27+
'yii\bootstrap\BootstrapAsset',
28+
];
29+
}

commands/HelloController.php

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
/**
3+
* @link http://www.yiiframework.com/
4+
* @copyright Copyright (c) 2008 Yii Software LLC
5+
* @license http://www.yiiframework.com/license/
6+
*/
7+
8+
namespace app\commands;
9+
10+
use yii\console\Controller;
11+
12+
/**
13+
* This command echoes the first argument that you have entered.
14+
*
15+
* This command is provided as an example for you to learn how to create console commands.
16+
*
17+
* @author Qiang Xue <[email protected]>
18+
* @since 2.0
19+
*/
20+
class HelloController extends Controller
21+
{
22+
/**
23+
* This command echoes what you have entered as the message.
24+
* @param string $message the message to be echoed.
25+
*/
26+
public function actionIndex($message = 'hello world')
27+
{
28+
echo $message . "\n";
29+
}
30+
}

composer.json

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"name": "yiisoft/yii2-app-basic",
3+
"description": "Yii 2 Basic Project Template",
4+
"keywords": ["yii2", "framework", "basic", "project template"],
5+
"homepage": "http://www.yiiframework.com/",
6+
"type": "project",
7+
"license": "BSD-3-Clause",
8+
"support": {
9+
"issues": "https://github.com/yiisoft/yii2/issues?state=open",
10+
"forum": "http://www.yiiframework.com/forum/",
11+
"wiki": "http://www.yiiframework.com/wiki/",
12+
"irc": "irc://irc.freenode.net/yii",
13+
"source": "https://github.com/yiisoft/yii2"
14+
},
15+
"minimum-stability": "stable",
16+
"require": {
17+
"php": ">=5.4.0",
18+
"yiisoft/yii2": ">=2.0.5",
19+
"yiisoft/yii2-bootstrap": "*",
20+
"yiisoft/yii2-swiftmailer": "*"
21+
},
22+
"require-dev": {
23+
"yiisoft/yii2-codeception": "*",
24+
"yiisoft/yii2-debug": "*",
25+
"yiisoft/yii2-gii": "*",
26+
"yiisoft/yii2-faker": "*"
27+
},
28+
"config": {
29+
"process-timeout": 1800
30+
},
31+
"scripts": {
32+
"post-create-project-cmd": [
33+
"yii\\composer\\Installer::postCreateProject"
34+
]
35+
},
36+
"extra": {
37+
"yii\\composer\\Installer::postCreateProject": {
38+
"setPermission": [
39+
{
40+
"runtime": "0777",
41+
"web/assets": "0777",
42+
"yii": "0755"
43+
}
44+
],
45+
"generateCookieValidationKey": [
46+
"config/web.php"
47+
]
48+
},
49+
"asset-installer-paths": {
50+
"npm-asset-library": "vendor/npm",
51+
"bower-asset-library": "vendor/bower"
52+
}
53+
}
54+
}

0 commit comments

Comments
 (0)