php学习资源_PHP7资源回顾

php学习资源

PHP 7 is well on its way. RFCs are being implemented and polished, projects are being tested, libraries upgraded. Extensions are being modified, and the word is spreading. All that remains is getting the shared hosts on the upgrade bandwagon – the arguably most difficult part of improving the global state of PHP. In this article, we’ll take a look at some of the most important PHP 7 related resources and tips you should go through in preparation for the new version.

PHP 7进展顺利。 正在实施和完善RFC,正在测试项目,升级库。 扩展名正在被修改,这个词正在传播。 剩下的就是使共享主机适应升级潮流-这可能是改善PHP全球状态最困难的部分。 在本文中,我们将介绍一些与PHP 7相关的最重要的资源,以及在准备新版本时应遵循的技巧。

Php7 logo by Vincent Pontier

Image via Vincent Pontier

图片来自Vincent Pontier

拉斯穆斯的盒子 (Rasmus’ box)

Some months back, Rasmus Lerdorf created and uploaded a Vagrant box for testing on PHP 7. This box can be downloaded from Github. In case the instructions are confusing (they shouldn’t be), see Rob Allen’s post. The box boots up in minutes and has not only PHP 7 enabled, but can also very easily update to the most recent version of PHP 7, and to dozens of other PHP versions.

几个月前,Rasmus Lerdorf创建并上传了一个Vagrant盒子,用于在PHP 7上进行测试。可以从Github下载该盒子。 万一说明令人困惑(不应该),请参阅Rob Allen的文章 。 该工具箱将在几分钟内启动,不仅启用了PHP 7,而且还可以非常容易地将其更新到最新版本PHP 7,以及数十个其他PHP版本。

The box features a newphp command which instantly replaces the PHP version currently in use with another binary, pre-compiled on the box. So for example, typing newphp 55 in the box will switch from PHP 7 to PHP 5.5., allowing you to quickly run your code in another version. What’s more, each version has its own PHP extensions folder, so you can easily compile and install new extensions – they all end up in the right location, and won’t conflict with other PHP binaries.

盒子中有一个newphp命令,该命令立即用盒子上预编译的另一个二进制文件立即替换当前正在使用PHP版本。 因此,例如,在框中键入newphp 55将从PHP 7切换到PHP 5.5。,使您可以快速在其他版本中运行代码。 此外,每个版本都有其自己PHP扩展文件夹,因此您可以轻松编译和安装新扩展-它们都位于正确的位置,并且不会与其他PHP二进制文件冲突。

In a way, it’s similar to DUnit which uses Docker containers to fire up different PHP versions for you to test on.

在某种程度上,它类似于DUnit ,后者使用Docker容器启动不同PHP版本供您测试。

For more information and some interesting benchmarks of various CMSes from Rasmus himself, see this talk slideshow of his.

有关Rasmus自己的各种CMS的更多信息和一些有趣的基准,请参阅此演讲幻灯片

其他盒子和测试 (Other boxes and Testing)

You should test your code on PHP 7. Early benchmarks are promising and many are jumping on board. Some even tested their real world apps and got some impressive results.

您应该测试您PHP 7月初的基准代码是有前途的 ,很多都跳在船上 。 有些甚至测试了他们的真实应用程序,并获得了令人印象深刻的结果。

Use Rasmus’ box above, or if you’re using PuPHPet, they recently added PHP7 support. There are some caveats, but in general, it should work. Vaprobash and Phansible aren’t there yet, but here’s hoping.

使用上方的Rasmus'框,或者如果您使用的是PuPHPet ,他们最近添加了PHP7支持 。 有一些警告,但是总的来说,它应该有效。 Vaprobash和Phansible还不存在,但是这是希望。

If you’d like to roll your own, this Ansible playbook for Ubuntu / Debian might help, or just go full-shell and follow these instructions – the post also has tips on writing tests for the actual PHP build, so you can contribute to the language itself!

如果您想自己动手, 这本适用于Ubuntu / Debian的Ansible剧本可能会有所帮助,或者完全按照下面的说明进行操作这篇文章还提供了针对实际PHP构建编写测试的提示,因此您可以为语言本身!

If you don’t feel like firing up VMs, you can use some of the official nightly builds (also supported via Docker) from Zend, but it’s also quite easy to do in Travis, which now includes PHP 7 in its builds. In fact, the phpleague/skeleton has this built-in. Just remember – if you’re using the Travis results to power Scrutinizer’s code analysis – you should allow failures on PHP 7 and maybe even make sure the report for PHP 7 doesn’t get submitted at all.

如果您不想启动虚拟机,则可以使用Zend的某些官方夜间构建 (也通过Docker支持),但是在Travis中也很容易做到,现在它的构建中包括PHP 7。 实际上, phpleague / skeleton具有此内置功能 。 只需记住-如果您使用Travis结果来增强Scrutinizer的代码分析 -您应该允许PHP 7失败,甚至可以确保根本不提交PHP 7的报告。

Testing for PHP7 on Travis not only makes sure your code works on the latest nightly without forcing you to manually update your PHP7 build, but also gives you some street cred to brag with – “My code is PHP7 ready!”.

在Travis上测试PHP7不仅可以确保您的代码在最新的夜间运行,而不会强迫您手动更新PHP7生成,而且还为您带来了一些赞誉–“我的代码已准备好PHP7!”。

更新扩展 (Updating Extensions)

Libraries, packages and apps aren’t the only that need testing, though. Like the March Newsletter said (to which you can subscribe via this form, btw), extensions are on the front lines. PHP7’s new extension API is different enough from the old versions that several extensions will need extensive rewrites to remain compatible.

但是,库,软件包和应用程序并不是唯一需要测试的。 就像March Newsletter所说的那样(您可以通过btw 填写此表单来订阅),扩展名是放在最前面。 PHP7的新扩展API与旧版本有很大的不同,以至于一些扩展需要大量重写才能保持兼容。

With that in mind, the gophp7-ext page has been set up to ease the transition for most extension developers.

考虑到这一点,已经设置了gophp7-ext页面以简化大多数扩展开发人员的过渡。

Hopefully, this will make it easier for projects like Zephir and the newly released Phalcon 2 to become 7-friendly as soon as possible (as the Phalcon team says, they’re already looking at the necessary PHP7 upgrades).

希望这将使诸如Zephir和新发布的Phalcon 2之类的项目更容易尽快变得7友好(正如Phalcon团队所说 ,他们已经在研究必要PHP7升级)。

If you develop PHP extensions (maybe you started after reading some of our tutorials?) or know people who do – point them to the GoPHP7-ext page and have them bring their code up to par. If you can get them to write about the process, documenting the changes that needed to be done, please do point them my way and we’ll publish their findings (and pay them handsomely for them), so others can benefit from learning about the process.

如果您开发PHP扩展(也许您是在阅读了一些教程之后就开始 ?)或知道这样做的人–请把它们指向GoPHP7-ext页面并让他们的代码达到标准。 如果您可以让他们撰写有关流程的文章,并记录需要完成的更改,请以我的方式指点他们,我们将发布他们的发现(并为他们支付可观的报酬),以便其他人可以从了解处理。

重要阅读 (Important Reading)

Finally, let’s list some of the most important reading resources you should go through to get on top of the changes that are coming up.

最后,让我们列出一些最重要的阅读资源,以掌握即将发生的变化。

  • Phil Sturgeon got the ball rolling with his post about the PHP7 feature freeze and the current state. It lists some of the more important RFCs, but you should look below to Davey’s post for a more detailed overview.

    菲尔•斯特金(Phil Sturgeon)在其有关PHP7功能冻结和当前状态的文章中取得了成功 。 它列出了一些更重要的RFC,但是您应该在Davey的帖子下面查找,以获得更详细的概述。

  • What to Expect is the first post you should read. It’s a two-part series from Davey Shafik, which explains the upcoming changes in a down-to-earth way. It’ll list all the important accepted RFCs and display demo code for each, so you can see how they might affect your workflow on practical examples.

    期待什么是您应该阅读的第一篇文章。 这是戴维·沙菲克(Davey Shafik)撰写的分为两部分的系列,它以扎实的方式解释了即将到来的变化。 它将列出所有重要的公认RFC,并显示每个RFC的演示代码,因此您可以在实际示例中了解它们如何影响您的工作流程。

  • PHP7 at a Glance from none other than Zend is yet another excellent overview. It features all the RFCs listed with their potential impact on a developer’s life plus the chances of BC breaks (there are some in edge cases, but none certain).

    Zend一览无余PHP7是另一个出色的概述。 它以列出的所有RFC为特色,这些RFC对开发人员的生活有潜在影响,并且有BC中断的可能性(在某些极端情况下,但不确定)。

  • Comparing PHP7 and Hack type systems implements the same functionality with type hints (now that they’re coming to PHP) in both PHP7 and Hack. The differences may surprise you, and might be something worth keeping in mind. The post has been discussed on Reddit.

    比较PHP7和Hack类型系统PHP7和Hack中都实现了带有类型提示的相同功能(现在它们已经成为PHP)。 这些差异可能会让您感到惊讶,并且可能值得牢记。 该帖子已在Reddit上进行了讨论

  • If you’re confused about the strict types, this still relevant post breaks it down.

    如果您对严格类型感到困惑,那么这篇仍然相关的文章将对其进行细分

  • PHP7 Revolution – Return Types and Removed Artifacts is our own preliminary look at PHP7 from way back when the announcement was still hot off the press. (Link added May 14th, 2015)

    PHP7 Revolution –返回类型和删除的工件是我们自己对PHP7的初步了解,当时该公告仍在媒体上热销。 (链接于2015年5月14日添加)

绩效统计 (Performance stats)

  • Zend put out this impressive looking infographic on performance. It doesn’t have the benchmarked source code or the environment details, though, so take it with a grain of salt. (Link added May 14th, 2015)

    Zend在性能上展示了这个令人印象深刻的图表 。 但是,它没有基准测试的源代码或环境细节,因此请耐心等待。 (链接于2015年5月14日添加)

结语 (Wrapping up)

As you can see, there’s a lot of content to go through – and version 7 is still months away. We’ll be updating this list with new resources periodically, so make sure you check back from time to time – newly added posts will be put to the bottom of their respective list and tagged with the date of addition.

如您所见,还有很多内容要经过–距版本7还有几个月。 我们将定期用新资源更新此列表,因此请确保您不时检查一下-新添加的帖子将置于其各自列表的底部,并用添加日期进行标记。

Do you know of any valuable resources we’ve missed? Want to write something for us? Let us know!

您是否知道我们错过的任何宝贵资源? 想为我们写点东西吗? 让我们知道!

翻译自: https://www.sitepoint.com/php7-resource-recap/

php学习资源

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值