Comments (52)
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.
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.
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.
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.
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.
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.
Also it would be good to have both web and console (at least very simple one) interface for the requirement checker.
from yii2.
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.
Sounds good to me including a requirement checker class into the core. Would you please propose some design and usage about it?
from yii2.
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.
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.
Can you insert a line in front of the class to detect the minimal PHP requirement for running the requirement checker?
from yii2.
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.
However, the higher minimum supported version, would allow creation of more gracefull implementation.
from yii2.
I think PHP 5.1 should be fine. For lower versions, the only drawback is the less pretty output.
from yii2.
mb_string as a required extension: #26
from yii2.
Implementation created under "yii/requirements".
Script "requirements.php" has been added to "bootstrap" application.
from yii2.
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.
@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:
from yii2.
Yes, @resurtm, I see. Need to think about this problem.
from yii2.
Perhaps the requirement "memo" column should be removed from the console interface.
from yii2.
@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.
the idea of 2 rows is better.. how about having the memo on the second line?
from yii2.
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.
May be I should not try to represent results as table.
from yii2.
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.
Blocks are fine.
from yii2.
Allright, I will rework console view to use blocks. This seems to be most realiable solution.
from yii2.
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.
@bwoester, yes this make sense.
from yii2.
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.
Done.
from yii2.
@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.
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.
from yii2.
Twitter boostrap style has been applied for "YiiRequirementChecker" web view.
from yii2.
from yii2.
PHP Intl extension has been added to default Yii requirements.
from yii2.
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)
from yii2.
"YiiRequirementChecker" fixed to determine console mode more precisely.
@githubjeka, try it now.
from yii2.
👍
from yii2.
@klimov-paul Maybe now array_key_exists ('argv', $ _SERVER)
is redundant?
from yii2.
Maybe now php array_key_exists ('argv', $ _SERVER) is redundant?
Indeed, it is. Already fixed.
from yii2.
@klimov-paul Is there anything to do here? Imo we can close this issue.
from yii2.
There is one question, which need to be decided: "should the checker support i18n?".
from yii2.
Yii 1.1.x requirements script fetches the language from user agent, while composing the web view. Should "YiiRequirementsChecker" so something similar?
from yii2.
Yeah, would be good so people can better understand what is missing when it is explained in their neative language.
from yii2.
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.
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.
I agree. No need for i18n there.
from yii2.
Okay with me. Just to mention: On linux you can figure out locale settings on console in case you want i18n.
from yii2.
OK, it is complete then.
from yii2.
Related Issues (20)
- Setting YII_DEBUG=false in humhub 1.15.2 leads to internal server error HOT 2
- Memory usage leak when long operation HOT 6
- createControllerByID function add cache? HOT 14
- Relational queries populating invalid models when foreign key / linking value is 0 HOT 1
- request` failed for
- asDuration() produce wrong plural form when using russian locale HOT 2
- hasOne or hasMany return null when $link with two bigint element
- YII2 whether support reset-transaction? HOT 1
- PHP Deprecated: Calling session_set_save_handler() in `PHP 8.4`. HOT 4
- If the iframe is nested in another domain name, there is an exception in the Yii2 site at https://, where there is a jump from http:// HOT 3
- Invalid fatal error handling in php 8.3 HOT 11
- Does yii2 support connection pooling using redis? HOT 1
- Wrong `columnQuoteCharacter` default in Schema for sqlite3 HOT 2
- wulan HOT 1
- Logic failed in RegularExpressionValidator
- Validator error handling in php 8.3 HOT 2
- How should I use Yii2 version 2.0.42.1 in my project HOT 3
- RequiredValidator with typed properties HOT 7
- Unable to resolve the request "--" with chroot HOT 1
- soft delete need official support.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yii2.