Git Product home page Git Product logo

yii2's Introduction

Yii Framework

Yii 2 is a modern framework designed to be a solid foundation for your PHP application.

It is fast, secure and efficient and works right out of the box pre-configured with reasonable defaults. The framework is easy to adjust to meet your needs, because Yii has been designed to be flexible.

Latest Stable Version Total Downloads Build Status codecov Scrutinizer Quality Score

Installation

  • The minimum required PHP version of Yii is PHP 7.3.
  • It works best with PHP 8.
  • Follow the Definitive Guide in order to get step by step instructions.

Documentation

Versions & PHP compatibility

Yii2 Version PHP version Development status EOL ¹
<= 2.0.49.* >= 5.4, <= 8.3 security fixes only 23 Nov 2026 ³
>= 2.0.50 >= 7.3, <= 8.4 bug fixes and security fixes only bugfixes till 23 Nov 2026 ³, security fixes till 21 Nov 2027 ⁴
>= 2.2.0 ² >= 8.1 active development

¹ All mentioned dates may be subject to change and no rights can be derived from them.
² Note: Yii 2.1 was skipped, Yii 2.2 has not yet been released.
³ PHP 8.3 EOL date.
Expected PHP 8.4 EOL date.

Community

Contributing

The framework is Open Source powered by an excellent community.

You may join us and:

Reporting Security issues

Please refer to a special page at the website describing proper workflow for security issue reports.

Directory Structure

build/               internally used build tools
docs/                documentation
framework/           core framework code
tests/               tests of the core framework code

Spreading the Word

Acknowledging or citing Yii 2 is as important as direct contributions.

In presentations

If you are giving a presentation or talk featuring work that makes use of Yii 2 and would like to acknowledge it, we suggest using our logo on your title slide.

In projects

If you are using Yii 2 as part of an OpenSource project, a way to acknowledge it is to use a special badge in your README:

Yii2

If your code is hosted at GitHub, you can place the following in your README.md file to get the badge:

[![Yii2](https://img.shields.io/badge/Powered_by-Yii_Framework-green.svg?style=flat)](https://www.yiiframework.com/)

Sponsoring

Support this project by becoming a sponsor or a backer.

OpenCollective sponsors OpenCollective backers

yii2's People

Contributors

abrahamgreyson avatar arhell avatar arogachev avatar brandonkelly avatar cebe avatar creocoder avatar cui-liang avatar cuileon avatar davidsonalencar avatar githubjeka avatar kartik-v avatar klimov-paul avatar larryullman avatar lucianobaraglia avatar mak-di avatar pana1990 avatar qiangxue avatar qiansen1386 avatar ragazzo avatar resurtm avatar rob006 avatar samdark avatar sammousa avatar schmunk42 avatar silverfire avatar softark avatar terabytesoftw avatar tonydspaniard avatar wintersilence avatar xhlstrive avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

yii2's Issues

Configuration

Often we have a problem with supporting several servers. I propose prepare smart config and make it depends from environment.

My opinion the next syntax can help flexible load configuration during environment. We get element with key '' and add to him element with environment name.

return array (
    '' => array(
        'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
        'name'=>'****',

        'db'=>array(
            'connectionString' => 'mysql:host=localhost;dbname=name',
            'emulatePrepare' => true,
            'username' => 'aaaa',
            'password' => 'aaaa',
            'charset' => 'utf8',
        ),
    ),

    'development' => array(

        'db'=>array (
            'username' => 'bbbb',
            'password' => 'bbbb',
        ),

    ),

    'test' => array()
)

Implement DbMessageSource

Similar as 1.1.
Please also refer to the implementation of DbCache and DbSession for API design of the class.

Minimal PHP version requirement

This ticket collects the minimal PHP version requirements from various classes. We will determine the final minimal version requirement when we finish the core framework classes.

Skeleton application: a fully fledged skeleton suitable for big applications

The skeleton should contain multi-tier directory structure (something similar to http://www.yiiframework.com/wiki/155/the-directory-structure-of-the-yii-project-site).

It should contain tools supporting environment switching, deployment, etc.

It should contain a ready-to-use backend, and a nearly empty frontend.

TODO:

  • rename backstagebackend

frontend

  • Login/signup via Facebook (extension?)
  • Signup.
  • Password reset.

backstage

  • Backstage layout.
  • RBAC-controller controller permissions.
  • Ability to generate frontend URLs.
  • Error log viewer.

console

  • Ability to generate frontend URLs.

Assets / packages management

Publishing a code snippet

\Yii::app()->clientScript->registerScript('name', 'some encoded js');

Packages

There should be no way to publish a file without defining a package for it in order
to support combining and processing assets. All the core classes, extensions and
modules should use packages.

Package definition

return array(
    'package1' => array(
        'basePath' => '@app/scripts'
        'map' => array(
            '*.js' => 'all.js', // append all JS into single file
            '*.ts' => 'all.js', // append all TypeScript into single file
        ),
        'process' => array(
            // how to deal with *.ts
            '*.ts' => function($fileName, $outputDir) {
                exec('…');
            }
        ),
    ),
    'package2' => array(
        'basePath' => '@app/styles',
        'map' => array(
            '*.less', // do not map, just include
        ),
        'process' => array(
            '*.less' => function($fileName, $outputDir) {
                exec(…);
            }
        ),
        'depends' => array(
            'package1',
        ),
    ),
);

Asset mappings

The idea of mappings is to be able to map one or more source files into same of less
number of destination files. Typically we have a number of source assets such as
a.js, b.js, c.js, d.js. We need to be able to map:

  1. Every *.js to all.js.
  2. a.js and b.js to ab.js while c.js and d.js to cd.js.

If all these from point 2 are separate packages, then if a is required ab.js
will be included in the page source.

By default each asset maps to the same named file.

Processing

  1. Determine the order of the scripts based on dependencies.
  2. Build ordered list.
  3. Iterate list, write contents of each file from the file itself to the corresponding map file.

Adding package on the fly

\Yii::app()->clientScript->addPackage('name', array(...definition...));

Adding package to the page

\Yii::app()->clientScript->registerPackage('name');

When doing it:

  • Check if package already registered. If yes, skip it.
  • Check if package has dependencies. If yes, process these one by one first.
  • Build a list of files from 'map'.
  • Iterate over 'map'. For each record:
    • Find matching files. Check if these are matching processing rules. If yes,
      process file.
    • After file is processed (or processing is skipped), write it to the corresponding
      file from 'map' or the the same named file if not defined.

Package processing

Common tasks needed for resources:

  1. Process resource content, write to the corresponding file. Processing can be either
    internal or external. Should be customizable per resource. Should support wildcards.
  2. Map multiple resources into single file. Support either just mapping or actual
    writing.
  3. Ability to specify how resource (or a wildcard) should be published
    (i.e. define a place on the page where it should be written).
  4. Ability to define how exactly resources are included and in which order.

Extensions

If extension registers any resources it should be specified in application's
extensions section of the config. Each record will point to extension's config.

The whole process should be described in the extension's readme.md. Will be automated
in future in case of installing via Composer.

Modules

We have a list of currently enabled modules in the application config (modules)
so we can get package definitions from module config file located at moduleName/config/packages.php.

Console color support

This is partially done: yii\helpers\ConsoleColor.
Remaining work:

  • rethink API
  • Grace fall back on unsupported terminals
  • implement wrappers in console/Controller
  • Test on most terminals
  • complete documentation
  • improve yii commands with color and other cute stuff
  • not add support for magic properties as global options (needed for color switch)

Asset Compressor

Service for collect resources(js,css) from included templates on page and merge it to one file. One for css and one for JavaScript.

yii2 现在进行的如何?

好像了解下yii2的情况, 目前已经完成多少.为何不释出让大家看看.也能讨论下yii2的需求.

哎哟不错哟.沙发,哈哈!希望别关掉了...

Skeleton application: a quickstart application

It should require minimal user configuration, and should be eye catching (probably use Twitter Bootstrap styling). Its file structure should be similar to that in 1.1.

The goal is to provide a skeleton for very simple Web applications which contain some static pages and a couple of dynamic pages (e.g. company info pages.)

Implement Debug Toolbar

Some references:

Features to implement:

  • Display internal route (module/controller/action).
  • Display view files used during current request.
  • Display SQL queries performed. Should be able to either display these sequentially, order by time, group similar queries while sorting by query count and displaying total time for a group.
  • Display GET/POST etc.
  • Provide API so developers will be able to add their own data to the toolbar.
  • Display framework version.
  • Display PHP version.
  • Overall time/memory for the current page.

Implement NoSQL Storage for ActiveRecord

Will implement:

redis (versions >= 2.6) (pull request: #905 merged)

elastic search (pull request: #1295 merged)

mongodb (pull request: #1438 merged)

Sphinx (Pull Request merged)

http://sphinxsearch.com/

Other systems that may get implemented (suggestions welcome):

Other resources:

Turn mbstring into a required php extension

In Yii 1.x, there is quite some code that seeks for support from PHP's multibyte string library, silently falling back if this extension is not installed. I'd like to propose turning mbstring into a required extension, improving multibyte string handling in a save fashion and increasing code readability in the core.

As I see it, this extension isn't too exotic for mass-webhosters as a number of applications either got soft or hard dependencies on mbstring (phpMyAdmin and Drupal got soft dependencies, Horde might cease function without it and I think same goes for Joomla).

Inter module communication

I am not sure what is the best place to put wish list, But it would be really help full if the framework provides some better approach for raising and handling events between different modules. Application level interrupts you can say.
like if a user save function is called, i can handle beforeSave afterSave of User model, in some other module.

Implement JUI extension

Similar to that in 1.1, but should be better designed (consistent with the design used in bootstrap extension).

Extension should be able to register its own translated messages

  1. In the application messageSource there should be sourcePaths property with empty array as default value.
  2. When searching for message files application message source component will start with paths from sourcePaths. If nothing matches it will fallback to default behavior i.e. checking application's messages directory (or what's set as messages directory).
  3. Extension author will be able to register additional message sources for his extension like the following:
\Yii::$app->messageSource['myExtension'] = __DIR__.'/messages';

A good place to have the code above is init method in case it's a Component or __construct if it's just a regular PHP class.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.