News

Apr 1, 2018

samdark

Yii2 Inspections 1.0.3 is out

Yii2 Inspections plugin for PhpStorm, adding many useful features, was updated to version 1.0.3. In this version some false positives in inspections were fixed along with fixing unexpected autocomplete being triggered.

Mar 29, 2018

nadar

LUYA Q1 2018 summary

LUYA Q1 2018

3 months ago we released LUYA version 1.0. Since then we have received a lot of positive feedback from developers around the world as well as requests for additions, improvements and bug fixes. Packagist notes more than 113'000 downloads and installs, including LUYA modules and extensions, and the project has received almost 500 stars on GitHub.

The LUYA future is headless

With the continuing development, we started to take LUYA into the direction of a headless system, which makes it rather unique among its kind. Headless systems will become more and more popular as they allow for lean, flexible and scalable applications that combine multiple specialized systems through their APIs.

The client library still need a lot of work, but they will get to the point where you can make a website without installing any dependencies by connecting to LUYA's headless client to retrieve menus, contents, properties or layouts. PSR6 compatible Caching will make the output blazingly fast! You won't have to deal with the application or the environment (e.g. get cms content and menu within your symfony application). Of course, collecting data from the built in or your own admin APIs is possible too.

We created a new API users endpoint which provides information about API access. You can test your endpoints and see what permissions are available:

API user overview

In order to see what the API users (or any other admin users) have done, we have also built a more detailed user activity summary:

User summary

All these changes are available now in luya admin module in version 1.1.0. A new guide section about the headless features is under development: https://luya.io/guide/concept-headless

Dockerized LUYA kickstarter

We also have released the luya kickstarter in version 1.0.1 with a dockerized development environment, which is now an integral part of the kickstarter. Thanks to contributor rainerCH who did a fantastic job in bringing all these LUYA specific requests into one place. We will evolve the Docker environment and provide a single image on dockerhub in the future.

Development environments for extension and module developers

LUYA env dev repo for extension and module developers is finished. The main purpose for this repo is an easy way for developers to create and maintain their own modules and extensions. It is also a good way for contributors who would like to help improve luya core modules as it will auto clone all core modules and update these with a single command ./vendor/bin/luyadev repo/update.

As the repos are bound into the env dev application with PSR4, we have written a library which auto updates your composer.json so you can easily clone your own repos into the env dev like ./vendor/bin/luyadev repo/clone USERNAME/LUYA_MODULE_REPO_NAME which will then update your composer.json and run composer dump-autoload. Don't miss to take a look at this shiny and new dev env. if you are interested in the development of modules, extensions or contributions.

Overview of enhancements and new features

  • A new user summary active window in the admin provides diff for changes inside ngrest tables.
  • The configuration now includes security options like luya\web\Application::$ensureSecureConnection or luya\web\Composition::$allowedHosts. See the new guide about security in LUYA: https://luya.io/guide/app-security
  • The admin security has been improved with permissions.
  • Admin and cms now have Chinese language support.
  • The testsuite includes new test cases and helper methods.
  • The error API was updated to provide a more detailed summary mail with application trace.
  • The JSON-LD output was improved for SEO purposes
  • Various fixes for PHP 7.2 compatibility

The remote admin provides an option to display the installed LUYA modules/extensions with their version numbers and info about whether they are current or outdated: Packages

We added a Matomo Module (former Piwik) dashboard object to provide information about visits via API: Matomo

The LUYA composer plugin now provides a plugin list in the admin UI: Debug Toolbar

New LUYA based open source project

A new open source project is almost ready: a time tracking tool based on LUYA, Angular and Bootstrap 4. Dtimer

We want you!

We are looking for people who help us with

  • Translations
  • Documentation (guide and phpdoc)
  • Module/extension development

If you are interested, please get into contact.

29 March 2018 LUYA developer team
luya.io

Mar 23, 2018

samdark

Yii development notes #21

New issue of Yii development notes: 2.0 releases, 2.1 post by Paul, https for Yii-realted websites and, finally, official site launch.

Mar 22, 2018

samdark

Finally releasing the new Yiiframework.com website

Yii team is ready to release new yiiframework.com website. The announcement itself is interesting but since it may not be available for some time, here's most important part:

We are going to switch to the new website on March 23, 2018 in the time frame 8:00 to 12:00 UTC. During the switch, you will not be able to write comments, wikis, forum entries etc. Also the documentation may not be available. You can use http://stuff.cebe.cc/yii2docs/ to view the documentation.

We will be avilable in the Slack chat and on IRC #yii on freenode, so if you need help, get there.

Mar 20, 2018

samdark

Releasing Yii 2.0.15 and database extensions with security fixes

Yii team released security fixes for framework and extensions. Details are in the announcements. Please update.

Mar 14, 2018

samdark

cebe/markdown 1.2.0 released

Carsten Brandt (@cebe) released new version of his markdown library that is used to render markdown in Yii including definitive guide and API docs.

Mar 14, 2018

samdark

Yii 2.0.14.2

A hotfix release was tagged yesterday. There are mostly 2.0.14 regressions and other bug fixes. No new features or intentional backwards compatibility breaks so it's safe to update.

Mar 3, 2018

klimov-paul

Yii 2.1 Early Access

Interested developers are welcome to try Yii 2.1 branch, which is already available for early access. It brings many new features and embraces PSR standards. However, it also brings significant backwards compatibility break. While it is not yet finished, it is already prepared for usage as a development platform.

Warning: Yii 2.1 branch is unstable and can be broken anytime, its current code may change dramatically before actual release. Do NOT attempt ot use it for the actual projects in 'production' stage, unless you are ready to deal with the consequences!

You can browse Yii 2.1 code at GitHub and install it using "2.1.x-dev" version for "yiisoft/yii2" Composer package.

Composer

In order to install Yii 2.1, you should specify version "2.1.x-dev" for "yiisoft/yii2" package in your 'composer.json' file:

"require": {
    "yiisoft/yii2": "2.1.x-dev",
    ...
}

Attention: since 2.1 Yii dropped its own PHP class autoloader in favor of the one provided by Composer. Thus you will need to configure "autoload" for your project at 'composer.json' otherwise PHP script will be unable to find classes declared at your project.

For example:

{
    "autoload": {
        "psr-4": {"app\\": ""}
    },
    "autoload-dev": {
        "psr-4": {"tests\\": "tests"}
    },
    ...
}

In case autoload for the project files is missing web application will trigger Yii application error like "Unable to resolve request 'site/error'".

Note that in 2.1 some former "yiisoft/yii2" package classes have been moved into separate repositories:

In case your project requires one of these, you should add corresponding packages to your composer.json. So in order get full equivalent of Yii 2.0 for 2.1, composer configuration should be the following:

"require": {
   "yiisoft/yii2": "2.1.x-dev",
   "yiisoft/yii2-jquery": "1.0.x-dev",
   "yiisoft/yii2-captcha": "1.0.x-dev",
   "yiisoft/yii2-rest": "1.0.x-dev",
   "yiisoft/yii2-mssql": "1.0.x-dev",
   "yiisoft/yii2-oracle": "1.0.x-dev",
   "yiisoft/yii2-maskedinput": "1.0.x-dev",
   ...
}

Most of the official extensions also have development branches compatible with Yii 2.1. The following composer configuration example will install all extensions available for 2.1:

"require": {
   "yiisoft/yii2": "2.1.x-dev",
   ...
   "yiisoft/yii2-debug": "2.1.x-dev",
   "yiisoft/yii2-gii": "2.1.x-dev",
   "yiisoft/yii2-swiftmailer": "2.2.x-dev",
   "yiisoft/yii2-bootstrap": "2.2.x-dev",
   "yiisoft/yii2-jui": "2.1.x-dev",
   "yiisoft/yii2-httpclient": "2.1.x-dev",
   "yiisoft/yii2-authclient": "2.2.x-dev",
   "yiisoft/yii2-mongodb": "2.2.x-dev",
   "yiisoft/yii2-sphinx": "2.2.x-dev",
   "yiisoft/yii2-imagine": "2.2.x-dev",
   "yiisoft/yii2-faker": "2.1.x-dev"
}

Basic code upgrade

Ensure that you code does not use any deprecated constructions like following:

  • Invocation of className(), e.g. SomeClass::className(). It should be replaced by native PHP ::class construction
  • Throwing or catching yii\base\InvalidParamException. It should be replaced by yii\base\InvalidArgumentException
  • Usage of yii\console\Controller constants, e.g. EXIT_CODE_NORMAL or EXIT_CODE_ERROR, for exit code. They should be replaced by constants provided via yii\console\ExitCode class.

Any DI object configuration should use '__class' keyword instead of 'class' for the class name specification. This affects DI container, Yii::createObject() and thus any application component specification. So former Yii application config like following:

return [
    'components' = [
        'mailer' => [
            'class' => yii\swiftmailer\Mailer::class,
        ],
        'mutex' => [
           'class' => yii\mutex\FileMutex::class
        ],
        'db' => [
            'class' => yii\db\Connection::class,
            'dsn' => 'mysql:host=localhost;dbname=myproject',
            'username' => '???',
            'password' => '???',
        ],
    ]
];

now should look like this:

return [
    'components' = [
        'mailer' => [
            '__class' => yii\swiftmailer\Mailer::class,
        ],
        'mutex' => [
           '__class' => yii\mutex\FileMutex::class
        ],
        'db' => [
            '__class' => yii\db\Connection::class,
            'dsn' => 'mysql:host=localhost;dbname=myproject',
            'username' => '???',
            'password' => '???',
        ],
        // ...
    ],
    // ...
];

Logging

At 2.1 logging has been rewritten according to PSR-3, which in particular allows you to use Monolog as logger for your project. Application component 'log' does not exist anymore. You should configure logger directly via Yii::setLogger() or using Application::setLogger(), e.g. 'logger' key in application config.

So former Yii log config like following:

return [
    'bootstrap' => [
        'log', // should be removed for 2.1
    ],
    'components' = [
        // should be converted to 'logger' for 2.1
        'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => yii\log\FileTarget::class,
                    'levels' => ['error', 'warning'],
                ],
            ],
        ],
        // ...
    ],
    // ...
];

now should look like this:

return [
    // no bootstrap
    'logger' => [
        'traceLevel' => YII_DEBUG ? 3 : 0,
        'targets' => [
            [
                '__class' => yii\log\FileTarget::class,
                'levels' => ['error', 'warning'],
            ],
        ],
    ],
    'components' = [
        // no 'log' component
        // ...
    ],
    // ...
];

Caching

At 2.1 caching has been rewritten according to PSR-16, which allows your usage of 3rd party cache providers easily. In order to keep 'cache dependency' feature cache specification has been changed. Now any cache component should use yii\caching\Cache class (or implement yii\caching\CacheInterface), while actual cache storage is determined via Cache::$handler.

So former Yii cache config like following:

return [
    'components' = [
        'cache' => [
            'class' => yii\caching\DbCache::class,
            'cacheTable' => 'my_cache',
        ],
        // ...
    ],
    // ...
];

now should look like this:

return [
    'components' = [
        'cache' => [
            '__class' => yii\caching\Cache::class,
            'handler' => [
                '__class' => yii\caching\DbCache::class,
                'cacheTable' => 'my_cache',
            ],
        ],
        // ...
    ],
    // ...
];

Be careful: it may happen, that in case of incorrect cache configuration (e.g. using old one), you will not receive an immediate error, but just some latent incorrect behavior.

JQuery

As it was already said all JQuery related code has been moved to "yiisoft/yii2-jquery" package. This, in particular, includes yii.js, client-side validation for ActiveForm and filter handler for GridView. Without extra adjustments simple usage of ActiveForm or GridView widget will no longer provide any JavaScript code registration, and thus no 'fancy' client-side effects. You will need to attach 'clientScript' behavior to the widget in order to make it behave like before.

ActiveForm example:

<?php $form = ActiveForm::begin([
    'id' => 'login-form',
    'as clientScript' => yii\jquery\ActiveFormClientScript::class, // attach JQuery client script, enabling client-side validation:
]); ?>
...
<?php ActiveForm::end(); ?>

GridView example:

<?= GridView::widget([
    'as clientScript' => yii\jquery\GridViewClientScript::class, // attach JQuery client script, enabling filter auto-submit
    'dataProvider' => $dataProvider,
    // ...
]); ?>

Live example

In order to get more clear impression on Yii 2.1 usage, you may refer to the working project template, which has been already updated to 2.1 - ii2tech/project-template

Install via composer:

composer create-project --prefer-dist --stability=dev yii2tech/project-template yii-test 2.0.x-dev

Install via git:

# clone repo:
git clone git@github.com:yii2tech/project-template.git yii-test
# go to project:
cd yii-test
# get 2.0 branch:
git fetch
git checkout 2.0

In order to configure project and make it running run 'install.php' file:

cd yii-test
php install.php

Feb 19, 2018

blacksmoke26

Fresh Yii and extension manuals in various formats

Fresh pack of manuals in various formats: CHM, PDF, webhelp, MS Word.

Changelog:

  • Updated according to Yii 2.0.14
  • Bootstrap => 2.0.8
  • Httpclient => 2.0.6
  • Sphinx => 2.0.10
  • MongoDB => 2.1.5

Feb 19, 2018

samdark

Faker extension version 2.0.4 released

Yii team tagged Faker extension version 2.0.4. It containes small bug fixed and enhancements.