Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
0b4b2b13
Commit
0b4b2b13
authored
Oct 18, 2014
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improved guide about using Yii in 3rd party systems
parent
d68d8628
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
9 deletions
+15
-9
tutorial-yii-integration.md
docs/guide/tutorial-yii-integration.md
+15
-9
No files found.
docs/guide/tutorial-yii-integration.md
View file @
0b4b2b13
...
@@ -5,12 +5,12 @@ From time to time, you may need to use some third-party code in your Yii applica
...
@@ -5,12 +5,12 @@ From time to time, you may need to use some third-party code in your Yii applica
use Yii as a library in some third-party systems. In this section, we will show how to achieve these goals.
use Yii as a library in some third-party systems. In this section, we will show how to achieve these goals.
## Using Third-Party Libraries in Yii <a name="using-libs-in-yii"></a>
Using Third-Party Libraries in Yii <a name="using-libs-in-yii"></a>
----------------------------------
To use a third-party library in a Yii application, you mainly need to make sure the classes in the library
To use a third-party library in a Yii application, you mainly need to make sure the classes in the library
are properly included or can be autoloaded.
are properly included or can be autoloaded.
### Using Composer Packages <a name="using-composer-packages"></a>
### Using Composer Packages <a name="using-composer-packages"></a>
Many third-party libraries are released in terms of
[
Composer
](
https://getcomposer.org/
)
packages.
Many third-party libraries are released in terms of
[
Composer
](
https://getcomposer.org/
)
packages.
...
@@ -31,7 +31,6 @@ require(__DIR__ . '/../vendor/autoload.php');
...
@@ -31,7 +31,6 @@ require(__DIR__ . '/../vendor/autoload.php');
require
(
__DIR__
.
'/../vendor/yiisoft/yii2/Yii.php'
);
require
(
__DIR__
.
'/../vendor/yiisoft/yii2/Yii.php'
);
```
```
### Using Downloaded Libraries <a name="using-downloaded-libs"></a>
### Using Downloaded Libraries <a name="using-downloaded-libs"></a>
If a library is not released as a Composer package, you should follow its installation instructions to install it.
If a library is not released as a Composer package, you should follow its installation instructions to install it.
...
@@ -71,7 +70,8 @@ Yii::$classMap['Class2'] = 'path/to/Class2.php';
...
@@ -71,7 +70,8 @@ Yii::$classMap['Class2'] = 'path/to/Class2.php';
```
```
## Using Yii in Third-Party Systems <a name="using-yii-in-others"></a>
Using Yii in Third-Party Systems <a name="using-yii-in-others"></a>
--------------------------------
Because Yii provides many excellent features, sometimes you may want to use some of its features to support
Because Yii provides many excellent features, sometimes you may want to use some of its features to support
developing or enhancing 3rd-party systems, such as WordPress, Joomla, or applications developed using other PHP
developing or enhancing 3rd-party systems, such as WordPress, Joomla, or applications developed using other PHP
...
@@ -82,10 +82,15 @@ take two steps: install Yii, and bootstrap Yii.
...
@@ -82,10 +82,15 @@ take two steps: install Yii, and bootstrap Yii.
If the third-party system uses Composer to manage its dependencies, you can simply run the following commands
If the third-party system uses Composer to manage its dependencies, you can simply run the following commands
to install Yii:
to install Yii:
```
composer global require "fxp/composer-asset-plugin:1.0.0-beta3"
composer require "yiisoft/yii2:*"
composer require "yiisoft/yii2:*"
composer install
composer install
```
The first command installs the
[
composer asset plugin
](
https://github.com/francoispluchino/composer-asset-plugin/
)
which allows managing bower and npm package dependencies through Composer. Even if you only want to use the database
layer or other non-asset related features of Yii, this is required to install the Yii composer package.
See also the general
[
section about installing Yii
](
start-installation.md#installing-via-composer
)
for more information
on Composer and solution to possible issues popping up during the installation.
Otherwise, you can
[
download
](
http://www.yiiframework.com/download/
)
the Yii release file and unpack it in
Otherwise, you can
[
download
](
http://www.yiiframework.com/download/
)
the Yii release file and unpack it in
the
`BasePath/vendor`
directory.
the
`BasePath/vendor`
directory.
...
@@ -112,7 +117,8 @@ Now you can use most features provided by Yii. For example, you can create Activ
...
@@ -112,7 +117,8 @@ Now you can use most features provided by Yii. For example, you can create Activ
to work with databases.
to work with databases.
## Using Yii 2 with Yii 1 <a name="using-both-yii2-yii1"></a>
Using Yii 2 with Yii 1 <a name="using-both-yii2-yii1"></a>
----------------------
If you were using Yii 1 previously, it is likely you have a running Yii 1 application. Instead of rewriting
If you were using Yii 1 previously, it is likely you have a running Yii 1 application. Instead of rewriting
the whole application in Yii 2, you may just want to enhance it using some of the features only available in Yii 2.
the whole application in Yii 2, you may just want to enhance it using some of the features only available in Yii 2.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment