Giter VIP home page Giter VIP logo

Comments (52)

alanwillms avatar alanwillms commented on May 30, 2024

PHP 5.5 is almost being released, so the stable versions will be 5.4 and 5.5.

Why don't you start supporting PHP 5.4+? I think until Yii 2 is ready PHP 5.3 will be deprecated.

from yii2.

samdark avatar samdark commented on May 30, 2024

We have only one minor thing that doesn't work on 5.3 so far so there's basically no need to require 5.4.

from yii2.

cebe avatar cebe commented on May 30, 2024

Why don't you start supporting PHP 5.4+? I think until Yii 2 is ready PHP 5.3 will be deprecated.

I think the word "support" is wrong here, we do support 5.4 but do not require it.

from yii2.

qiangxue avatar qiangxue commented on May 30, 2024

Please focus on discussing how the requirement checker should be implemented instead of which version is required. We will choose the minimal version that suits Yii 2 the best.

from yii2.

samdark avatar samdark commented on May 30, 2024

I think current 1.1 implementation is OK. As a bonus we can move detection code into a separate class and expose it to CLI.

from yii2.

klimov-paul avatar klimov-paul commented on May 30, 2024

I would like to have requirements checker as part of the core, which allows to add extra requirements, specific to the particular application.
When I create an application based on Yii this application may add some extra requirements and I would like to have some "requirement checker" out of the box. Such checker could have some interface and ability to add or update some requirements.

from yii2.

klimov-paul avatar klimov-paul commented on May 30, 2024

Also it would be good to have both web and console (at least very simple one) interface for the requirement checker.

from yii2.

rcoelho avatar rcoelho commented on May 30, 2024

Agreed with @samdark on separating it and with @klimov-paul on making it extensible for the application's own requirements.
With this, we can use the API exposed by the requirements class in an script (an installer or deployer console script) transparently to the user and warn him only if the requirement check fails.

from yii2.

qiangxue avatar qiangxue commented on May 30, 2024

Sounds good to me including a requirement checker class into the core. Would you please propose some design and usage about it?

from yii2.

bwoester avatar bwoester commented on May 30, 2024

Does anyone know a library or tool to take this a step further? I think of an analyzer that collects all used classes and functions, then looks up their requirements from some sort of database. Output might be grouped into PHP versions/ extensions with a list of source code occurrences and counters. Something that could tell you: "Your app requires PHP 5.3, with the extens x, y and z enabled. But because of those two lines of code, you need PHP 5.4 and another extension".

from yii2.

klimov-paul avatar klimov-paul commented on May 30, 2024

There is an important question in this matter: how old PHP version should "requirements checker" support.
By support I mean it should run without errors like "unknown function 'some'".
At the moment I am working on the solution which requires PHP 4.3 as minimum, but still provide an object interface.

from yii2.

qiangxue avatar qiangxue commented on May 30, 2024

Can you insert a line in front of the class to detect the minimal PHP requirement for running the requirement checker?

from yii2.

klimov-paul avatar klimov-paul commented on May 30, 2024

Of course,I can use something like:

if (version_compare(get_php_version(), '4.3','<')) {
    echo('PHP 4.3 or higher required');
    exit(1);
}
class RequirementChecker {
    ...
}

from yii2.

klimov-paul avatar klimov-paul commented on May 30, 2024

However, the higher minimum supported version, would allow creation of more gracefull implementation.

from yii2.

qiangxue avatar qiangxue commented on May 30, 2024

I think PHP 5.1 should be fine. For lower versions, the only drawback is the less pretty output.

from yii2.

qiangxue avatar qiangxue commented on May 30, 2024

mb_string as a required extension: #26

from yii2.

klimov-paul avatar klimov-paul commented on May 30, 2024

Implementation created under "yii/requirements".
Script "requirements.php" has been added to "bootstrap" application.

from yii2.

klimov-paul avatar klimov-paul commented on May 30, 2024

Created implementation is based on "requirements" solution from Yii 1.1.x.
However, there are several questions, which need to be decided:

  • should the checker suport i18n
  • which requirements should be considered as Yii core ones

from yii2.

resurtm avatar resurtm commented on May 30, 2024

@klimov-paul, looks nice but it has problems with 80 characters wide terminals/shells. For instance MinGW Bourne Again Shell window could not be made wider and thus affected by this limitation. Screenshot below:

mingw-bash

from yii2.

klimov-paul avatar klimov-paul commented on May 30, 2024

Yes, @resurtm, I see. Need to think about this problem.

from yii2.

klimov-paul avatar klimov-paul commented on May 30, 2024

Perhaps the requirement "memo" column should be removed from the console interface.

from yii2.

resurtm avatar resurtm commented on May 30, 2024

@klimov-paul, have you thought about expanding each requirements item on two lines? In particular when rendering on terminals narrower than hundred characters.

from yii2.

mdomba avatar mdomba commented on May 30, 2024

the idea of 2 rows is better.. how about having the memo on the second line?

from yii2.

klimov-paul avatar klimov-paul commented on May 30, 2024

have you thought about expanding each requirements item on two lines?

I am not sure the list will look good in this way, although may be I should try.

In particular when rendering on shells narrower than hundred characters.

Is there a reliable mechanism to determine terminal width? I suppose no.

from yii2.

klimov-paul avatar klimov-paul commented on May 30, 2024

May be I should not try to represent results as table.

from yii2.

klimov-paul avatar klimov-paul commented on May 30, 2024

Perhaps it would be better to list the requirements by blocks:

Name: Requirement1
Result: passed
Required by: Yii
Memo: memo1

Name: Requirement2
Result: passed
Required by: Yii
Memo: memo2

Errors: 0 Warnings: 0 Total checks: 2

from yii2.

samdark avatar samdark commented on May 30, 2024

Blocks are fine.

from yii2.

klimov-paul avatar klimov-paul commented on May 30, 2024

Allright, I will rework console view to use blocks. This seems to be most realiable solution.

from yii2.

bwoester avatar bwoester commented on May 30, 2024

I think the important stuff are failed tests. Just as in unit testing. Stuff that passes doesn't need to be displayed as prominently. So it could be:

Req1 OK
Req2 OK

Name: Requirement3
Result: failed
Required by: Yii
Memo: memo1

Req4 OK
Req5 OK

Errors: 1 Warnings: 0 Total checks: 5

from yii2.

klimov-paul avatar klimov-paul commented on May 30, 2024

@bwoester, yes this make sense.

from yii2.

klimov-paul avatar klimov-paul commented on May 30, 2024

Will look like following:

Check conclusion:
-----------------
PHP version: OK
Reflection extension: OK
PCRE extension: OK
SPL extension: OK
MBString extension: OK
PDO extension: OK
PDO SQLite extension: OK
PDO MySQL extension: OK
Memcache extension: OK
APC extension: WARNING!!!
Required by: CApcCache
Mcrypt extension: OK
PHP safe mode: OK
Expose PHP: OK
PHP allow url include: OK
PHP mail SMTP: OK
------------------------------------------
Errors: 0   Warnings: 1   Total checks: 15

from yii2.

klimov-paul avatar klimov-paul commented on May 30, 2024

Done.

from yii2.

qiangxue avatar qiangxue commented on May 30, 2024

@klimov-paul I just made some minor code style changes: e951939
Overall, this looks great!

I'm not quite sure if the requirements in the bootstrap app should contain so many things (some don't really belong to the bootstrap app). It looks daunting to new users if they try to cook some requirements.

Perhaps we should try some new styling for the web view? How about http://twitter.github.io/bootstrap/base-css.html#tables

from yii2.

klimov-paul avatar klimov-paul commented on May 30, 2024

I'm not quite sure if the requirements in the bootstrap app should contain so many things

I have put them there as demo. We will rework this list after creation the "app" command is finished.

Perhaps we should try some new styling for the web view?

Should be possible, I have thought about this. Current web representation just copies Yii 1.1.x.

from yii2.

samdark avatar samdark commented on May 30, 2024

#241

from yii2.

klimov-paul avatar klimov-paul commented on May 30, 2024

Twitter boostrap style has been applied for "YiiRequirementChecker" web view.

from yii2.

samdark avatar samdark commented on May 30, 2024

#312

from yii2.

klimov-paul avatar klimov-paul commented on May 30, 2024

PHP Intl extension has been added to default Yii requirements.

from yii2.

githubjeka avatar githubjeka commented on May 30, 2024

win7 openserver
When I run the browser http://bootstrap/requirements.php, I get console/index

https://github.com/yiisoft/yii2/blob/master/yii/requirements/YiiRequirementChecker.php#L155
dump($_SERVER)
screen

Maybe http://stackoverflow.com/questions/1042501/how-to-check-with-php-if-the-script-is-being-run-from-the-console-or-browser-req

from yii2.

klimov-paul avatar klimov-paul commented on May 30, 2024

"YiiRequirementChecker" fixed to determine console mode more precisely.
@githubjeka, try it now.

from yii2.

githubjeka avatar githubjeka commented on May 30, 2024

👍

from yii2.

githubjeka avatar githubjeka commented on May 30, 2024

@klimov-paul Maybe now array_key_exists ('argv', $ _SERVER) is redundant?

from yii2.

klimov-paul avatar klimov-paul commented on May 30, 2024

Maybe now php array_key_exists ('argv', $ _SERVER) is redundant?

Indeed, it is. Already fixed.

from yii2.

cebe avatar cebe commented on May 30, 2024

@klimov-paul Is there anything to do here? Imo we can close this issue.

from yii2.

klimov-paul avatar klimov-paul commented on May 30, 2024

There is one question, which need to be decided: "should the checker support i18n?".

from yii2.

klimov-paul avatar klimov-paul commented on May 30, 2024

Yii 1.1.x requirements script fetches the language from user agent, while composing the web view. Should "YiiRequirementsChecker" so something similar?

from yii2.

cebe avatar cebe commented on May 30, 2024

Yeah, would be good so people can better understand what is missing when it is explained in their neative language.

from yii2.

klimov-paul avatar klimov-paul commented on May 30, 2024

Do not forget that console representation of requirements checker has no way to determine the user language, so practically it will always be displayed in English.
"i18n" is a complex addition to requirements checker and will require additional translation effots, because its interface and implementation can not match standard "Yii::t()".

I need more opinions on this feature before I will start to implement it.

from yii2.

qiangxue avatar qiangxue commented on May 30, 2024

I think it's fine we do not support i18n for requirement checker, because the checker (especially the console version) is mainly used by developers rather than end users.

from yii2.

samdark avatar samdark commented on May 30, 2024

I agree. No need for i18n there.

from yii2.

cebe avatar cebe commented on May 30, 2024

Okay with me. Just to mention: On linux you can figure out locale settings on console in case you want i18n.

from yii2.

klimov-paul avatar klimov-paul commented on May 30, 2024

OK, it is complete then.

from yii2.

Related Issues (20)

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.