mirror of
https://github.com/yiisoft/yii2.git
synced 2025-12-19 07:07:58 +08:00
Renamed application template into project template in docs
This commit is contained in:
@@ -106,7 +106,7 @@ class DevController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* This command installs an application template in the `apps` directory and links the framework and extensions
|
||||
* This command installs a project template in the `apps` directory and links the framework and extensions
|
||||
*
|
||||
* It basically runs the following commands in the dev repo root:
|
||||
*
|
||||
@@ -120,6 +120,7 @@ class DevController extends Controller
|
||||
*
|
||||
* @param string $app the application name e.g. `basic` or `advanced`.
|
||||
* @param string $repo url of the git repo to clone if it does not already exist.
|
||||
* @return int return code
|
||||
*/
|
||||
public function actionApp($app, $repo = null)
|
||||
{
|
||||
|
||||
@@ -162,7 +162,7 @@ Testing
|
||||
Special Topics
|
||||
--------------
|
||||
|
||||
* [Advanced Application Template](https://github.com/yiisoft/yii2-app-advanced/blob/master/docs/guide/README.md)
|
||||
* [Advanced Project Template](https://github.com/yiisoft/yii2-app-advanced/blob/master/docs/guide/README.md)
|
||||
* [Building Application from Scratch](tutorial-start-from-scratch.md)
|
||||
* [Console Commands](tutorial-console.md)
|
||||
* [Core Validators](tutorial-core-validators.md)
|
||||
|
||||
@@ -27,12 +27,12 @@ For example, if a class name and namespace is `foo\bar\MyClass`, the [alias](con
|
||||
would be `@foo/bar/MyClass.php`. In order for this alias to be resolvable into a file path,
|
||||
either `@foo` or `@foo/bar` must be a [root alias](concept-aliases.md#defining-aliases).
|
||||
|
||||
When using the [Basic Application Template](start-installation.md), you may put your classes under the top-level
|
||||
When using the [Basic Project Template](start-installation.md), you may put your classes under the top-level
|
||||
namespace `app` so that they can be autoloaded by Yii without the need of defining a new alias. This is because
|
||||
`@app` is a [predefined alias](concept-aliases.md#predefined-aliases), and a class name like `app\components\MyClass`
|
||||
can be resolved into the class file `AppBasePath/components/MyClass.php`, according to the algorithm just described.
|
||||
|
||||
In the [Advanced Application Template](tutorial-advanced-app.md), each tier has its own root alias. For example,
|
||||
In the [Advanced Project Template](tutorial-advanced-app.md), each tier has its own root alias. For example,
|
||||
the front-end tier has a root alias `@frontend`, while the back-end tier root alias is `@backend`. As a result,
|
||||
you may put the front-end classes under the namespace `frontend` while the back-end classes are under `backend`. This will
|
||||
allow these classes to be autoloaded by the Yii autoloader.
|
||||
@@ -66,7 +66,7 @@ also install those.
|
||||
When using the Yii autoloader together with other autoloaders, you should include the `Yii.php` file
|
||||
*after* all other autoloaders are installed. This will make the Yii autoloader the first one responding to
|
||||
any class autoloading request. For example, the following code is extracted from
|
||||
the [entry script](structure-entry-scripts.md) of the [Basic Application Template](start-installation.md). The first
|
||||
the [entry script](structure-entry-scripts.md) of the [Basic Project Template](start-installation.md). The first
|
||||
line installs the Composer autoloader, while the second line installs the Yii autoloader:
|
||||
|
||||
```php
|
||||
|
||||
@@ -91,7 +91,7 @@ The configuration for an [application](structure-applications.md) is probably on
|
||||
This is because the [[yii\web\Application|application]] class has a lot of configurable properties and events.
|
||||
More importantly, its [[yii\web\Application::components|components]] property can receive an array of configurations
|
||||
for creating components that are registered through the application. The following is an abstract from the application
|
||||
configuration file for the [basic application template](start-installation.md).
|
||||
configuration file for the [Basic Project Template](start-installation.md).
|
||||
|
||||
```php
|
||||
$config = [
|
||||
|
||||
@@ -110,7 +110,7 @@ If the validation is successful, then we're saving the file:
|
||||
$model->file->saveAs('uploads/' . $model->file->baseName . '.' . $model->file->extension);
|
||||
```
|
||||
|
||||
If you're using the "basic" application template, then folder `uploads` should be created under `web`.
|
||||
If you're using the "basic" project template, then folder `uploads` should be created under `web`.
|
||||
|
||||
That's it. Load the page and try uploading. Uploads should end up in `basic/web/uploads`.
|
||||
|
||||
|
||||
@@ -503,9 +503,9 @@ User and IdentityInterface
|
||||
|
||||
The `CWebUser` class in 1.1 is now replaced by [[yii\web\User]], and there is no more
|
||||
`CUserIdentity` class. Instead, you should implement the [[yii\web\IdentityInterface]] which
|
||||
is much more straightforward to use. The advanced application template provides such an example.
|
||||
is much more straightforward to use. The advanced project template provides such an example.
|
||||
|
||||
Please refer to the [Authentication](security-authentication.md), [Authorization](security-authorization.md), and [Advanced Application Template](tutorial-advanced-app.md) sections for more details.
|
||||
Please refer to the [Authentication](security-authentication.md), [Authorization](security-authorization.md), and [Advanced Project Template](tutorial-advanced-app.md) sections for more details.
|
||||
|
||||
|
||||
URL Management
|
||||
|
||||
@@ -144,7 +144,7 @@ the following variables if the error action is defined as [[yii\web\ErrorAction]
|
||||
* `exception`: the exception object through which you can retrieve more useful information, such as HTTP status code,
|
||||
error code, error call stack, etc.
|
||||
|
||||
> Info: If you are using the [basic application template](start-installation.md) or the [advanced application template](tutorial-advanced-app.md),
|
||||
> Info: If you are using the [basic project template](start-installation.md) or the [advanced project template](tutorial-advanced-app.md),
|
||||
the error action and the error view are already defined for you.
|
||||
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ Authentication is the act of verifying who a user is, and is the basis of the lo
|
||||
In Yii, this entire process is performed semi-automatically, leaving the developer to merely implement [[yii\web\IdentityInterface]], the most important class in the authentication system. Typically, implementation of `IdentityInterface` is accomplished using the `User` model.
|
||||
|
||||
You can find a fully featured example of authentication in the
|
||||
[advanced application template](tutorial-advanced-app.md). Below, only the interface methods are listed:
|
||||
[advanced project template](tutorial-advanced-app.md). Below, only the interface methods are listed:
|
||||
|
||||
```php
|
||||
class User extends ActiveRecord implements IdentityInterface
|
||||
|
||||
@@ -303,7 +303,7 @@ After executing the command with `yii rbac/init` we'll get the following hierarc
|
||||
Author can create post, admin can update post and do everything author can.
|
||||
|
||||
If your application allows user signup you need to assign roles to these new users once. For example, in order for all
|
||||
signed up users to become authors in your advanced application template you need to modify `frontend\models\SignupForm::signup()`
|
||||
signed up users to become authors in your advanced project template you need to modify `frontend\models\SignupForm::signup()`
|
||||
as follows:
|
||||
|
||||
```php
|
||||
|
||||
@@ -4,18 +4,18 @@ Installing Yii
|
||||
You can install Yii in two ways, using the [Composer](http://getcomposer.org/) package manager or by downloading an archive file.
|
||||
The former is the preferred way, as it allows you to install new [extensions](structure-extensions.md) or update Yii by simply running a single command.
|
||||
|
||||
Standard installations of Yii result in both the framework and an application template being downloaded and installed.
|
||||
An application template is a working Yii application implementing some basic features, such as login, contact form, etc.
|
||||
Standard installations of Yii result in both the framework and a project template being downloaded and installed.
|
||||
A project template is a working Yii project implementing some basic features, such as login, contact form, etc.
|
||||
Its code is organized in a recommended way. Therefore, it can serve as a good starting point for your projects.
|
||||
|
||||
In this and the next few sections, we will describe how to install Yii with the so-called *Basic Application Template* and
|
||||
In this and the next few sections, we will describe how to install Yii with the so-called *Basic Project Template* and
|
||||
how to implement new features on top of this template. Yii also provides another template called
|
||||
the [Advanced Application Template](tutorial-advanced-app.md) which is better used in a team development environment
|
||||
the [Advanced Project Template](tutorial-advanced-app.md) which is better used in a team development environment
|
||||
to develop applications with multiple tiers.
|
||||
|
||||
> Info: The Basic Application Template is suitable for developing 90 percent of Web applications. It differs
|
||||
from the Advanced Application Template mainly in how their code is organized. If you are new to Yii, we strongly
|
||||
recommend you stick to the Basic Application Template for its simplicity yet sufficient functionalities.
|
||||
> Info: The Basic Project Template is suitable for developing 90 percent of Web applications. It differs
|
||||
from the Advanced Project Template mainly in how their code is organized. If you are new to Yii, we strongly
|
||||
recommend you stick to the Basic Project Template for its simplicity yet sufficient functionalities.
|
||||
|
||||
|
||||
Installing via Composer <span id="installing-via-composer"></span>
|
||||
@@ -84,7 +84,7 @@ But there are other installation options available:
|
||||
* If you only want to install the core framework and would like to build an entire application from scratch,
|
||||
you may follow the instructions as explained in [Building Application from Scratch](tutorial-start-from-scratch.md).
|
||||
* If you want to start with a more sophisticated application, better suited to team development environments,
|
||||
you may consider installing the [Advanced Application Template](tutorial-advanced-app.md).
|
||||
you may consider installing the [Advanced Project Template](tutorial-advanced-app.md).
|
||||
|
||||
|
||||
Verifying the Installation <span id="verifying-installation"></span>
|
||||
|
||||
@@ -11,7 +11,7 @@ how the code is organized, and how the application handles requests in general.
|
||||
your application to be `http://hostname/index.php` or something similar.
|
||||
For your needs, please adjust the URLs in our descriptions accordingly.
|
||||
|
||||
Note that unlike framework itself, after application template is installed it's all yours. You're free to add or delete
|
||||
Note that unlike framework itself, after project template is installed it's all yours. You're free to add or delete
|
||||
code and overall modify it as you need.
|
||||
|
||||
|
||||
|
||||
@@ -153,7 +153,7 @@ During the bootstrapping process, each component will be instantiated. If the co
|
||||
implements [[yii\base\BootstrapInterface]], its [[yii\base\BootstrapInterface::bootstrap()|bootstrap()]] method
|
||||
will also be called.
|
||||
|
||||
Another practical example is in the application configuration for the [Basic Application Template](start-installation.md),
|
||||
Another practical example is in the application configuration for the [Basic Project Template](start-installation.md),
|
||||
where the `debug` and `gii` modules are configured as bootstrapping components when the application is running
|
||||
in development environment,
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ its corresponding fully qualified PHP class name (without the leading backslash)
|
||||
be [autoloadable](concept-autoloading.md). It usually specifies where the assets are located, what CSS and
|
||||
JavaScript files the bundle contains, and how the bundle depends on other bundles.
|
||||
|
||||
The following code defines the main asset bundle used by [the basic application template](start-installation.md):
|
||||
The following code defines the main asset bundle used by [the basic project template](start-installation.md):
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
@@ -25,7 +25,7 @@ Entry scripts mainly do the following work:
|
||||
|
||||
## Web Applications <span id="web-applications"></span>
|
||||
|
||||
The following is the code in the entry script for the [Basic Web Application Template](start-installation.md).
|
||||
The following is the code in the entry script for the [Basic Web Project Template](start-installation.md).
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
@@ -503,7 +503,7 @@ you may take the following strategy:
|
||||
define a concrete model class by extending from the corresponding base model class. The concrete model classes
|
||||
should contain rules and logic that are specific for that application or module.
|
||||
|
||||
For example, in the [Advanced Application Template](tutorial-advanced-app.md), you may define a base model
|
||||
For example, in the [Advanced Project Template](tutorial-advanced-app.md), you may define a base model
|
||||
class `common\models\Post`. Then for the front end application, you define and use a concrete model class
|
||||
`frontend\models\Post` which extends from `common\models\Post`. And similarly for the back end application,
|
||||
you define `backend\models\Post`. With this strategy, you will be sure that the code in `frontend\models\Post`
|
||||
|
||||
@@ -12,7 +12,7 @@ framework that allows you to create the following test types:
|
||||
|
||||
Yii provides ready to use test sets for all three test types in both
|
||||
[`yii2-basic`](https://github.com/yiisoft/yii2/tree/master/apps/basic) and
|
||||
[`yii2-advanced`](https://github.com/yiisoft/yii2/tree/master/apps/advanced) application templates.
|
||||
[`yii2-advanced`](https://github.com/yiisoft/yii2/tree/master/apps/advanced) project templates.
|
||||
|
||||
In order to run tests you need to install [Codeception](https://github.com/Codeception/Codeception). A good way to
|
||||
install it is the following:
|
||||
|
||||
@@ -8,7 +8,7 @@ The structure of console applications is very similar to a Yii web application.
|
||||
or more [[yii\console\Controller]] classes, which are often referred to as "commands" in the console environment.
|
||||
Each controller can also have one or more actions, just like web controllers.
|
||||
|
||||
Both Application templates already have a console application with them.
|
||||
Both project templates already have a console application with them.
|
||||
You can run it by calling the `yii` script, which is located in the base directory of the repository.
|
||||
This will give you a list of available commands when you run it without any further parameters:
|
||||
|
||||
@@ -95,7 +95,8 @@ As can be seen in the code above, the console application uses its own configura
|
||||
you should configure various [application components](structure-application-components.md) and properties for the console application in particular.
|
||||
|
||||
If your web application and console application share a lot of configuration parameters and values, you may consider moving the common
|
||||
parts into a separate file, and including this file in both of the application configurations (web and console). You can see an example of this in the "advanced" application template.
|
||||
parts into a separate file, and including this file in both of the application configurations (web and console).
|
||||
You can see an example of this in the "advanced" project template.
|
||||
|
||||
> Tip: Sometimes, you may want to run a console command using an application configuration that is different
|
||||
> from the one specified in the entry script. For example, you may want to use the `yii migrate` command to
|
||||
|
||||
@@ -6,7 +6,7 @@ Shared hosting environments are often quite limited about configuration and dire
|
||||
Deploying a basic application
|
||||
---------------------------
|
||||
|
||||
Since in a shared hosting environment there's typically only one webroot, use the basic application template if you can. Refer to the [Installing Yii chapter](start-installation.md) and install the basic application template locally. After you have the application working locally, we'll make some adjustments so it can be hosted on your shared hosting server.
|
||||
Since in a shared hosting environment there's typically only one webroot, use the basic project template if you can. Refer to the [Installing Yii chapter](start-installation.md) and install the basic project template locally. After you have the application working locally, we'll make some adjustments so it can be hosted on your shared hosting server.
|
||||
|
||||
### Renaming webroot <span id="renaming-webroot"></span>
|
||||
|
||||
@@ -20,7 +20,7 @@ www
|
||||
|
||||
In the above, `www` is your webserver webroot directory. It could be named differently. Common names are: `www`, `htdocs`, and `public_html`.
|
||||
|
||||
The webroot in our basic application template is named `web`. Before uploading the application to your webserver rename your local webroot to match your server, i.e., from `web` to `www`, `public_html` or whatever the name of your hosting webroot.
|
||||
The webroot in our basic project template is named `web`. Before uploading the application to your webserver rename your local webroot to match your server, i.e., from `web` to `www`, `public_html` or whatever the name of your hosting webroot.
|
||||
|
||||
### FTP root directory is writeable
|
||||
|
||||
|
||||
@@ -4,10 +4,10 @@ Creating your own Application structure
|
||||
> Note: This section is under development.
|
||||
|
||||
While the [basic](https://github.com/yiisoft/yii2-app-basic) and [advanced](https://github.com/yiisoft/yii2-app-advanced)
|
||||
application templates are great for most of your needs, you may want to create your own application template with which
|
||||
project templates are great for most of your needs, you may want to create your own project template with which
|
||||
to start your projects.
|
||||
|
||||
Application templates in Yii are simply repositories containing a `composer.json` file, and registered as a Composer package.
|
||||
Project templates in Yii are simply repositories containing a `composer.json` file, and registered as a Composer package.
|
||||
Any repository can be identified as a Composer package, making it installable via `create-project` Composer command.
|
||||
|
||||
Since it's a bit too much to start building your entire template from scratch, it is better to use one of the built-in
|
||||
@@ -47,7 +47,7 @@ For private templates, it is a bit more tricky to register the package. For inst
|
||||
Use the Template
|
||||
------
|
||||
|
||||
That's all that's required to create a new Yii application template. Now you can create projects using your template:
|
||||
That's all that's required to create a new Yii project template. Now you can create projects using your template:
|
||||
|
||||
```
|
||||
composer global require "fxp/composer-asset-plugin:1.0.0"
|
||||
|
||||
@@ -183,7 +183,7 @@ Yii Framework 2 Change Log
|
||||
|
||||
- Bug #5577: formatting date and time values for years >=2038 or <=1901 on 32bit systems will not use intl extension but fall back to the PHP implementation (cebe)
|
||||
- Bug #6080: Oracle DB schema did not load column types correctly (wenbin1989)
|
||||
- Bug #6404: advanced application template `Alert` widget was generating duplicate IDs in case of multiple flashes (SDKiller)
|
||||
- Bug #6404: advanced project template `Alert` widget was generating duplicate IDs in case of multiple flashes (SDKiller)
|
||||
- Bug #6557: Link URLs generated by `yii\widgets\Menu` are not encoded (qiangxue)
|
||||
- Bug #6632: `yii\di\Container::get()` did not handle config parameter correctly when it is passed as a constructor parameter (qiangxue)
|
||||
- Bug #6648: Added explicit type casting to avoid dblib issues on SQL Server 2014 (o-rey)
|
||||
@@ -779,7 +779,7 @@ Yii Framework 2 Change Log
|
||||
- Bug #1654: Fixed the issue that a new message source object is generated for every new message being translated (qiangxue)
|
||||
- Bug #1582: Error messages shown via client-side validation should not be double encoded (qiangxue)
|
||||
- Bug #1591: StringValidator is accessing undefined property (qiangxue)
|
||||
- Bug #1597: Added `enableAutoLogin` to basic and advanced application templates so "remember me" now works properly (samdark)
|
||||
- Bug #1597: Added `enableAutoLogin` to basic and advanced project templates so "remember me" now works properly (samdark)
|
||||
- Bug #1631: Charset is now explicitly set to UTF-8 when serving JSON (samdark)
|
||||
- Bug #1635: `yii\jui\SliderInput` wasn't properly initialized (samdark)
|
||||
- Bug #1659: MSSQL doesn't support limit (Ana1oliy)
|
||||
@@ -867,7 +867,7 @@ Yii Framework 2 Change Log
|
||||
- Enh #1585: added schema parameter to createAbsoluteUrl() to force 'http' or 'https' (cebe)
|
||||
- Enh #1601: Added support for tagName and encodeLabel parameters in ButtonDropdown (omnilight)
|
||||
- Enh #1611: Added `BaseActiveRecord::markAttributeDirty()` (qiangxue)
|
||||
- Enh #1633: Advanced application template now works with MongoDB by default (samdark)
|
||||
- Enh #1633: Advanced project template now works with MongoDB by default (samdark)
|
||||
- Enh #1634: Use masked CSRF tokens to prevent BREACH exploits (qiangxue)
|
||||
- Enh #1641: Added `BaseActiveRecord::updateAttributes()` (qiangxue)
|
||||
- Enh #1646: Added postgresql `QueryBuilder::checkIntegrity` and `QueryBuilder::resetSequence` (Ragazzo)
|
||||
@@ -930,7 +930,7 @@ Yii Framework 2 Change Log
|
||||
- Enh #2892: ActiveRecord dirty attributes are now reset after call to `afterSave()` so information about changed attributes is available in `afterSave`-event (cebe)
|
||||
- Enh #2910: Added `Application::end()` (qiangxue)
|
||||
- Enh: Added support for using arrays as option values for console commands (qiangxue)
|
||||
- Enh: Added `favicon.ico` and `robots.txt` to default application templates (samdark)
|
||||
- Enh: Added `favicon.ico` and `robots.txt` to default project templates (samdark)
|
||||
- Enh: Added `Widget::autoIdPrefix` to support prefixing automatically generated widget IDs (qiangxue)
|
||||
- Enh: Support for file aliases in console command 'message' (omnilight)
|
||||
- Enh: Sort and Pagination can now create absolute URLs (cebe)
|
||||
|
||||
@@ -184,7 +184,7 @@ Upgrade from Yii 2.0 Beta
|
||||
];
|
||||
```
|
||||
|
||||
> Note: If you are using the `Advanced Application Template` you should not add this configuration to `common/config`
|
||||
> Note: If you are using the `Advanced Project Template` you should not add this configuration to `common/config`
|
||||
or `console/config` because the console application doesn't have to deal with CSRF and uses its own request that
|
||||
doesn't have `cookieValidationKey` property.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user