Download the PHP package itstructure/yii2-admin-module without Composer

On this page you can find all versions of the php package itstructure/yii2-admin-module. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?
itstructure/yii2-admin-module
Rate from 1 - 5
Rated 5.00 based on 1 reviews

Informations about the package yii2-admin-module

Yii2 Admin module

Latest Stable Version Latest Unstable Version License Total Downloads Build Status Scrutinizer Code Quality

Introduction

Yii2AdminModule -- Module for the Yii2 framework with AdminLTE template, which provides the following options:

Module functional block scheme:

Admin module scheme

Note!!!

As this module gives you a freedom in the architecture of your application child classes, pay attention:

Base project example, which uses this admin module for multilanguage content and dashboard: yii2-template-multilanguage.

Base project example, which uses this admin module for simple data: yii2-template-simple.

Addition module description you can see in my Personal site.

Dependencies

Installation

Via composer:

composer require itstructure/yii2-admin-module ~1.8.7

Usage

Main properties

The name of module: admin

The namespace for used classes: Itstructure\AdminModule.

The alias to access in to module root directory: @admin.

The main module template layout is in: @admin/views/layouts/main-admin.php.

Application config

Base application config must be like in example below:

Here,

viewPath - view template location for CRUDs, which you will create in application.

CatalogController - example controller.

accessRoles - an array of roles, that are allowed to access. Bu default ['@'].

in components the view component contains required parameter class. Such parameters as skin, bodyLayout - dashboard style, can be set custom.

Parameter mainMenuConfig - is the sidebar admin menu, which must be an array:

Parameter extraAssets - extra assets, can be like in examples:

Base controllers

In Yii2AdminModule there are two controllers, which can be used by child application controllers:

Integrated controllers

In Yii2AdminModule there is one integrated controller:

Multilanguage mode for dashboard tools

Multilanguage mode just for dashboard you can set by language parameter in app configuration: en-US, ru-RU e.t.c.

Multilanguage mode for data

There is an opportunity to set modes by application configuration, using parameter:

And application configuration will take an appearance:

In multilanguage mode, such a standard is adopted:

  1. All multilanguage fields will be with a language postfix:

    title_en

    description_en, e t. c.

  2. Single and multilanguage fields will be rendered in view template by spectial fields widget.

  3. All fields values after form sending will be loaded to the MultilanguageValidateModel by MultilanguageValidateComponent in CommonAdminController.

  4. Then MultilanguageValidateModel will load validated values in to the main model.

  5. In main model the field values will be processed by MultilanguageTrait to separate their between own main model and translate model.

  6. As a model in view template, it will the MultilanguageValidateModel, that is set by MultilanguageValidateComponent in CommonAdminController.

  7. Rules configuration for multilanguage fields validation need to be set in individual component config.

  8. Rules configuration for single fields validation need to be set in the main model.

  9. All the above configurations will be combined in MultilanguageValidateModel for general process.

To use this mode it's necessary:

  1. Set module parameter isMultilanguage on true in application config section mdules -> admin.

  2. Apply module migration: migrations/multilanguage/m171202_104405_create_language_table

    For that make next, if not already done:

    • Define admin module in application console config file:

    • In file yii, that is located in application root directory, set @admin alias:

      OR

    • Run command in console:

      yii migrate --migrationPath=@admin/migrations/multilanguage

    • Check if the sidebar link to manage languages is appeared.
  3. Application migrations must be extended from Itstructure\AdminModule\components\MultilanguageMigration

    It's necessary to automatically creation main table and translate table.

  4. Data base tables will have a structure, like in example:

    Main table "catalog"

    | id | order |      created_at     |      updated_at     |
    |----|-------|---------------------|---------------------|
    | 1  |   2   | 2018-01-14 18:06:33 | 2018-01-14 18:06:33 |
    | 2  |   1   | 2018-01-14 18:10:00 | 2018-01-14 18:10:00 |
    | 3  |   3   | 2018-01-14 19:05:15 | 2018-01-14 19:05:15 |

    Translate table "catalog_language"

    | catalog_id | language_id |   title   |      description     |      created_at     |      updated_at     |
    |------------|-------------|-----------|----------------------|---------------------|---------------------|
    |      1     |      1      | Catalog 1 |     Description 1    | 2018-01-14 18:06:33 | 2018-01-14 18:06:33 |
    |      1     |      2      | Каталог 1 |     Описание 1       | 2018-01-14 18:06:33 | 2018-01-14 18:06:33 |
    |      2     |      1      | Catalog 2 |     Description 2    | 2018-01-14 18:10:00 | 2018-01-14 18:10:00 |
    |      3     |      1      | Catalog 3 |     Description 3    | 2018-01-14 19:05:15 | 2018-01-14 19:05:15 |
    |      3     |      2      | Каталог 3 |     Описание 3       | 2018-01-14 19:05:15 | 2018-01-14 19:05:15 |

    Language table "language"

    | id | locale | shortName |  name   | default |      created_at     |      updated_at     |
    |----|--------|-----------|---------|---------|---------------------|---------------------|
    | 1  | en-US  |    en     | English |    1    | 2018-01-14 18:06:33 | 2018-01-14 18:06:33 |
    | 2  | ru-RU  |    ru     | Русский |    0    | 2018-01-14 18:10:00 | 2018-01-14 18:10:00 |

    Here,

    Not multilanguage fields: id, order.

    Multilanguage fields: title, description.

  5. For all described tables above, it is necessary to create CRUD model classes, like in exemple:

    Catalog - main model

    CatalogLanguage - translate model

    Language - already exists in module!

  6. In child application admin controller define function getModelName(), like in example:

  7. In child application admin controller define function getSearchModelName(), like in example:

  8. In main model, use trait, like in example:

    Using this trait, the multilanguage fields values, that are set like for example title_en, description_en, will be redirected to the translate model automatically.

    Not multilanguage fields, such as order e. t. c., will be set in to the main model automatically.

  9. To display form fields in view templates use special widget (installed by composer.json dependency):

    as in example:

    Here,

    • Language - is a class in Itstructure\AdminModule\models\Language.php

    • This widget (when for example two languages ru and en) will parse the form fields so:

      title_en

      title_ru

      description_en

      description_ru

    • if do not set the attribute languageModel, form fields will not be multilanguage and will be single.

    • $model - will be set automatically in CommonAdminController as object of Itstructure\AdminModule\models\MultilanguageValidateModel, in which the main model can be set after define her class name by method getModelName().
  10. Configure the multilanguage component multilanguage-validate-component for admin module with rules for validation multilanguage data in application config, like in example:

Useful feature:

After release 1.6.2 in MultilanguageValidateModel class the mainModelAttributes() method checking is added to check its presence in main model. This may be necessary when you need to validate fields that are not in the database table. These fields can be set in this method, in addition to the main fields. The method must return an array.

License

Copyright © 2018-2023 Andrey Girnik [email protected].

Licensed under the MIT license. See LICENSE.txt for details.


All versions of yii2-admin-module with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1.0
yiisoft/yii2 Version 2.*
yiisoft/yii2-bootstrap Version ^2.0
almasaeed2010/adminlte Version ~2.4.3
itstructure/yii2-field-widgets Version ^1.2.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package itstructure/yii2-admin-module contains the following files

Loading the files please wait ....