search
HomePHP FrameworkYIIHow to install yii2-adminlte

How to install yii2-adminlte

Jan 21, 2020 pm 01:03 PM
yii2

How to install yii2-adminlte

How to install yii2-adminlte? Install AdminLTE and yii2-admin [Version 2.0]

1. Install AdminLTE rendering backend

1. Use AdminLTE rendering backend template

AdminLTE is a fully responsive admin template. Based on Bootstrap3 framework, easy to customize templates. Fits a variety of screen resolutions, from small mobile devices to large desktops. It has multiple built-in pages, including dashboard, email, calendar, lock screen, login and registration, 404 error, 500 error and other pages.

Enter cmd, switch to the advanced directory, enter

composer require dmstr/yii2-adminlte-asset "2.*"

Copy vendor/dmstr/yii2-adminlte-asset/example-views/yiisoft/yii2-app to backend/views/, need to be overwritten The coverage is

2. Enter the backend 127.0.0.1/advanced/backend/web/ to view the effect

3. URL beautification

① Configuration: backend/config/main. php file components

"urlManager" => [
    //用于表明 urlManager 是否启用URL美化功能
    "enablePrettyUrl" => true,
    // 是否在URL中显示入口脚本
    "showScriptName" => false,
],

② Download the .htaccess file and place it in the backend/web directory (this is to hide Index.php, apache must enable the rewrite module)

II , Install yii2-admin and integrate rbac

1, yii2-admin is a set of management tools for yii2 rbac, which implements a beautiful interface and complete permission management functions

Enter cmd, switch to the advanced directory, enter

composer require mdmsoft/yii2-admin "2.x-dev"

2. Configure the backend/config/main.php file

"modules" => [
    "admin" => [
        "class" => "mdm\admin\Module",
    ],
],
"aliases" => [
    "@mdm/admin" => "@vendor/mdmsoft/yii2-admin",
],
'as access' => [
    'class' => 'mdm\admin\components\AccessControl',
    'allowActions' => [
        //这里是允许访问的action
        //controller/action
    // * 表示允许所有,后期会介绍这个
        '*'
    ]
],
'components' => [
    "authManager" => [
        "class" => 'yii\rbac\DbManager',
        "defaultRoles" => ["guest"],
    ],
],

3. Import the rbac table

and execute. sql file: vendor/yiisoft/yii2/rbac/migrations/schema-mysql.sql

4. Run 127.0.0.1/advanced/backend/web/admin/route to preview the effect.

Recommended learning: yii tutorial

The above is the detailed content of How to install yii2-adminlte. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
What Skills Are Required to Become a Successful Yii Developer?What Skills Are Required to Become a Successful Yii Developer?May 13, 2025 am 12:01 AM

TobecomeasuccessfulYiideveloper,youneed:1)PHPmastery,2)understandingofMVCarchitecture,3)Yiiframeworkproficiency,4)databasemanagementskills,5)front-endknowledge,6)APIdevelopmentexpertise,7)testinganddebuggingcapabilities,8)versioncontrolproficiency,9)

Yii Developers: Common ErrorsYii Developers: Common ErrorsMay 12, 2025 am 12:04 AM

ThemostcommonerrorsinYiiframeworkare"UnknownProperty","InvalidConfiguration","ClassNotFound",and"ValidationErrors".1."UnknownProperty"errorsoccurwhenaccessingnon-existentproperties;ensurepropertiesexi

Yii Developer: Most recquired skills in EuropeYii Developer: Most recquired skills in EuropeMay 11, 2025 am 12:02 AM

The key skills that European Yii developers need to possess include: 1. Yii framework proficiency, 2. PHP proficiency, 3. Database management, 4. Front-end skills, 5. RESTful API development, 6. Version control system, 7. Testing and debugging, 8. Security knowledge, 9. Agile methodology, 10. Soft skills, 11. Localization and internationalization, 12. Continuous learning, these skills make developers stand out in the European market.

Yii: Is the community still active?Yii: Is the community still active?May 10, 2025 am 12:03 AM

Yes,theYiicommunityisstillactiveandvibrant.1)TheofficialYiiforumremainsaresourcefordiscussionsandsupport.2)TheGitHubrepositoryshowsregularcommitsandpullrequests,indicatingongoingdevelopment.3)StackOverflowcontinuestohostYii-relatedquestionsandhigh-qu

Is it easy to migrate a Laravel Project to Yii?Is it easy to migrate a Laravel Project to Yii?May 09, 2025 am 12:01 AM

Migratingalaravel Projecttoyiiishallingbutachieffable WITHIEFLEFLANT.1) Mapoutlaravel component likeroutes, Controllers, Andmodels.2) Translatelaravel's SartisancommandeloequentTooyii's giiandetiverecordeba

Essential Soft Skills for Yii Developers: Communication and CollaborationEssential Soft Skills for Yii Developers: Communication and CollaborationMay 08, 2025 am 12:11 AM

Soft skills are crucial to Yii developers because they facilitate team communication and collaboration. 1) Effective communication ensures that the project is progressing smoothly, such as through clear API documentation and regular meetings. 2) Collaborate to enhance team interaction through Yii's tools such as Gii to improve development efficiency.

Laravel MVC : What are the best benefits?Laravel MVC : What are the best benefits?May 07, 2025 pm 03:53 PM

Laravel'sMVCarchitectureoffersenhancedcodeorganization,improvedmaintainability,andarobustseparationofconcerns.1)Itkeepscodeorganized,makingnavigationandteamworkeasier.2)Itcompartmentalizestheapplication,simplifyingtroubleshootingandmaintenance.3)Itse

Yii: Is It Still Relevant in Modern Web Development?Yii: Is It Still Relevant in Modern Web Development?May 01, 2025 am 12:27 AM

Yiiremainsrelevantinmodernwebdevelopmentforprojectsneedingspeedandflexibility.1)Itoffershighperformance,idealforapplicationswherespeediscritical.2)Itsflexibilityallowsfortailoredapplicationstructures.However,ithasasmallercommunityandsteeperlearningcu

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.