In the local server configuration, you do your development, then copy the sources to the server.
- SwooleChannel::construct — Construct a Swoole Channel; SwooleChannel::destruct — Destruct a Swoole channel. SwooleChannel::pop — Read and pop data from swoole channel. SwooleChannel::push — Write and push data into Swoole channel. SwooleChannel::stats — Get stats of swoole channel. SwooleClient — The SwooleClient class.
- Yaf、yar、yac、yaconf、Redis、Swoole、msgpack、xhprof等PHP框架或扩展在IDE下自动识别类、常量、自动补全方法名 Idea Php Annotation Plugin ⭐ 209 Add PHP annotation support for PhpStorm and IntelliJ.
Swoole IDE Helper. Auto completion, trigger suggest and view docs for Swoole in editor. The purpose of avoid the tips of undefined and improve work efficiency. Usage Composer (recommended): composer require -dev 'eaglewu/swoole-ide-helper:dev-master' Text editor: Put the source code in your project. Put the source code path into. This is the second post about Swoole and it contains code samples that take advantage of Swoole asynchronous functions and coroutines. The first post can be found here. Asynchronous 1: We put each request in a separate coroutine and pass them a channel through which they will pass to us the results of each request.
A local server is a server that is running in a local or a mounted folder and whose document root is NOT the parent of the project root.
To configure access to the server in this set-up, you need to specify the following:
The server configuration root folder and the URL address to access it.
Correspondence between the project root folder, the folder on the server to copy the data from the project root folder to, and the URL address to access the copied data on the server. This correspondence is called mapping.
Specify the name, type, and visibility of a server configuration
Open the Deployment page by doing one of the following:
In the Settings/Preferences dialog Ctrl+Alt+S, go to Build, Execution, Deployment | Deployment.
From the main menu, select Tools | Deployment | Configuration.
In the left-hand pane that lists all the existing server configurations, click Add and select Local or mounted folder in the popup menu.
In the Create new server dialog that opens, type the name of the server to create and click OK. The Create new server dialog closes and you return to the Connection tab of the Deployment node.
Click the Use as Default to have PhpStorm silently apply the current configuration in the following cases:
Automatic upload of changed files.
Manual upload and download of files without choosing the target host.
Comparing local files and folders with their remote versions.
Editing individual files on remote hosts.
Use the Visible only for this project checkbox to configure the visibility of the server access configuration.
Select the checkbox to restrict the use of the configuration to the current project. Such configuration cannot be reused outside the current project. It does not appear in the list of available configurations in other projects.
The server records are stored in the .idea directory together with the project, which allows sharing them between team members through a VCS.
In the server access configurations list in the left-hand pane, the configurations visible only in the current project are marked with the icon.
When the checkbox is cleared, the configuration is visible in all PhpStorm projects. Its settings can be reused across several projects.
Specify the server configuration root and the URL address to access it
Open the Deployment page by doing one of the following:
In the Settings/Preferences dialog Ctrl+Alt+S, go to Build, Execution, Deployment | Deployment.
From the main menu, select Tools | Deployment | Configuration.
Click the Connection tab.
In the Folder field, specify the server configuration root.
The server configuration root is the highest folder in the file tree on the server that can be accessed through the server configuration. The easiest way is to use the document root of your Web server as defined in the Web server configuration file. However you can appoint any other existing folder under the document root.
In the Web server URL field, specify the URL address of the server configuration root. This URL address will be the starting point for building the URL address of your application. Depending on your choice of the server configuration root, do one of the following: Uptodown games free download.
Type the URL address associated with the document root of your Web server as defined in the Web server configuration file.
Type the URL address in the following format:
<Server document root URL>/<path to the folder relative to the server document root>
Both the HTTP and the HTTPS protocols are supported.
Phpstorm Swoole 提示
Map project folders to folders on the server and the URL addresses to access them
Configure mappings, that is, set correspondence between the project folders, the folders on the server to copy project files to, and the URL addresses to access the copied data on the server. The easiest way is to map the entire project root folder to a folder on the server. The project folder structure in this case will be repeated on the server, provided that you have selected the Create Empty directories checkbox in the Options dialog. For more details, see Configure synchronization with a Web server and Customize upload and download.
Open the Deployment page by doing one of the following:
In the Settings/Preferences dialog Ctrl+Alt+S, go to Build, Execution, Deployment | Deployment.
From the main menu, select Tools | Deployment | Configuration.
Click the Mappings tab.
In the Local Path field, specify the full path to the desired local folder. In the simplest case it is the project root.
In the Deployment Path field, specify the folder on the server where PhpStorm will upload the data from the folder specified in the Local Path field. Type the path to the folder relative to the server configuration root.
If the folder with the specified name does not exist yet, PhpStorm will create it, provided that you have selected the Create Empty directories checkbox in the Options dialog. For more details, see Customize upload and download.
In the Web Path field, type the path to the folder on the server relative to the server configuration root. Actually, type the relative path you typed in the Deployment Path field.
Example of specifying a server configuration root
For example, the server's default document root is the htdocs folder, and the default URL address to access the data is http://localhost. Let's suppose that you are using the XAMPP package and it is installed in the root of the C:/ drive.
If you decide to copy your project files directly under the server document root, your server configuration root will be C:xampphtdocs and its URL will be http://localhost:<port>.
You can establish a more complicated folder structure on the server, for example, to have MySite1 and MySite2 folders under the server document root. In this case the you will have to decide which of these folders you will use in the current configuration, let it be MySite2. Accordingly, the server configuration root will be C:xampphtdocsMySite2 and its URL address will be http://localhost:<port>MySite2.
Example of mapping project folders with folders on the server
For example, if your project is located under C:My_ProjectsMapping_project, the server document root is C:xampphtdocs, the server configuration root is C:xampphtdocsMySite2, and its URL address is http://localhost:<port>MySite2, fill in the fields as follows:
In the Local Path field, type C:My_ProjectsMapping_project.
Canon ir 2020 driver for mac. In the Deployment Path field, type
MySite2
.In the Web Path field, type
MySite2
.
Greetings everyone,
Please welcome the June edition of PHP Annotated!
PHP internals have been very active and here are 3 accepted and 6 new RFCs, including alternative syntax for attributes — @@
and why #[]
is better. There also has been some drama around renaming in the PHP world, and about PHP developers’ debugging practices. And as usual, a load of useful articles, tools, videos, podcasts, and more.
⚡️ News & Releases
- PHP turned 25 — Check out the timeline with the most important events in PHP history.
- PHP 7.4.7 — Among other things, this update fixes a bug with
yield from
. - The State of Developer Ecosystem in 2020 — Links straight to the PHP section of the JetBrains developer survey.
65% of respondents pointed out that they use the ‘dump & die’ approach to debugging. So the tweet from the author of Xdebug, Derick Rethans, was always going to cause a strong reaction in the community:PHP developers that don't use Xdebug for debugging are amateurs. Buck rogers complete series download torrent.
— Derick Rethans 🔶 (@derickr) June 20, 2020
🐘 PHP Internals
- ✅ [RFC] Attribute Amendments — Attributes received a few additions: grouping capability
<<Attr1, Attr2>>
, renamingPhpAttribute
toAttribute
, validation, and the ability to add multiple identical attributes. - ✅ [RFC] Ensure correct signatures of magic methods — As for now, you can declare a magic method like this in a class:
In PHP 8 however, signatures of magic methods will be validated and the code above will cause a compile-time error. - ✅ [RFC] Make sorting stable — All standard sort functions in PHP (sort, usort, asort, etc.) starting with PHP 8.0 will be stable. This means that the original element order with the same values is guaranteed. In current versions, it is easy to find examples where this is not the case.
- ❌ [RFC] Opcache optimization without any caching — Declined.
- [RFC] Make constructors and destructors return void — In current PHP versions, you can return any values from constructors and destructors, for example:
Benas Seliuginas proposed to throw aDeprecated
warning in such cases, and later in PHP 9.0 to remove this and generate aFatal Error
. - [RFC] Treat namespaced names as single token — Each element of the namespace is treated by the interpreter as a separate token. This is why there can be no keywords used in namespaces. For example,
namespace appfunction { class Foo {} };
will fail with aParse Error
. Nikita Popov proposed to consider the entire namespace as a single token as this would minimize backward compatibility problems when introducing new keywords. - [RFC] Rename T_PAAMAYIM_NEKUDOTAYIM to T_DOUBLE_COLON — The token
::
in PHP is calledT_PAAMAYIM_NEKUDOTAYIM
— this fact was even pointed out as problem number one in the famous PHP Sadness list.
George Peter Banyard and Kalle Sommer Nielsen suggested renaming it. We’re not sure this makes sense, as the error messages always note::
.
Also, why remove a fun historical quirk? - [RFC] Shorter Attribute Syntax — Attributes have already been accepted for PHP 8, but many people do not like the syntax. Three options are being put to the vote:
<<Attr>>
(current) vs.@@Attr
vs.#[Attr]
. Brent Roоse had several convincing arguments for#[ ]
:- It’s the same syntax as Rust, which is also a C-based language.
- It’s compatible with old code:
#[Attribute]
will be just ignored by PHP <=7.4 as a comment. @@
can be confused with the error suppress operator (example).<<>>
is also confusing, as it looks like bit-shift operators. In the future, it can be confused with generics that are likely to use the single angle brackets syntax<>
.
In the meantime,
@@
seems to be getting more votes. - [RFC] Change terminology to ExcludeList — The topic of renaming offensive terms has not been overlooked by the PHP world either. There have been heated discussions in the Internals.
In the PHP core, the change affects only one thing: the configuration directiveopcache.blacklist_filename
should be renamed toopcache.exclude_list_filename
.Many other PHP tools have already made changes in this regard: PHPUnit, Drupal, Xdebug, Yii, Composer (+ working with non-master Git branches).
There is also a discussion on set of rules for PHP_CodeSniffer to find offensive words.
- [RFC] Nullsafe operator — Instead of a bunch of nested conditions, Ilija Tovilo proposed to add the ability to refer to a property or method with a check for
null
:
Instead of - PHP 8.0 release schedule was updated — The feature freeze has been moved to August 4, and the final release is scheduled for November 26.
- You can try PHP 8 on 3v4l.org. Just check out the output in the php-master branch.
🛠 Tools
- beyondcode/expose — A tunneling service implemented in pure PHP on top of ReactPHP. An alternative to ngrok. You can run your own self-hosted server too. See more details about how it works.
- pestphp/pest — A tool that is built on top of PHPUnit and allows you to write tests in a simple elegant way. There is documentation and lots of videos. Inspired by facebook/jest.
- Moxio/sqlite-extended-api — The real demonstration of how FFI and lisachenko/z-engine can help: the package provides a couple of SQLite API methods that are not available in the standard PHP drivers.
- FriendsOfPHP/pickle — A PECL extensions manager that is compatible with Composer. This is the first update since 2015 and it finally seems to have a plan with Composer.
- doctrine/migrations 3.0.0 — A major update to the well-known package for handling DB migrations.
Symfony
- Symfony 5.1 was released.
- Symfony 5 certification is now available.
- In Symfony 6, configurations will be handled in usual PHP files instead of YAML or XML.
- dbu/snake-bundle — A snake game implemented on symfony/console.
- How much of a performance boost can you expect for a Symfony 5 app with PHP OPcache preloading?
- 10 Symfony testing tips.
- Protect Symfony app against the OWASP Top 10 threats.
Laravel
- spatie/laravel-cronless-schedule — A package for performing scheduled tasks without cron. It uses ReactPHP and timers under the hood. For more details check out the intro post.
- Adding try/catch Laravel collections.
- Laravel package ecosystem statistics.
✨ In this thread I'll list tactics you can use to write cleaner code in Laravel.
As you use them repeatedly, you'll develop a sense for what's good code and what's bad code.
I'll also sprinkle some general Laravel code advice in between these tactics.
THREAD
— Samuel Stancl (@samuelstancl) June 16, 2020
Yii
- Yii2 & Doctrine ORM simple integration.
Zend/Laminas
Phpstorm Swoole-ide-helper
- Is Zend Framework Dead? — The Laminas project lead Matthew Weier O’Phinney answers this and a other questions.
- asgrim/mini-mezzio — Set up Mezzio applications even faster by using this package.
🌀 Async PHP
- badfarm/zanzara — An asynchronous framework for creating Telegram bots based on ReactPHP.
- simple-swoole/simps — Yet another Swoole-based framework. According to the benchmarks, it is the fastest one written in PHP.
- 📺 Video course on ReactPHP by Marcel Pociot.
💡 Misc
- Introducing the new Serverless LAMP stack — A post on the AWS blog about using serverless PHP, and a collection of links on the topic.
Also, Amazon’s official AWS Toolkit plugin is now available for PhpStorm. - Learn more about Constructor promotion in PHP 8.
- What are the top most used PHP functions in frameworks? — In Symfony it’s
sprintf()
, in Laravel it’sis_null()
. There are instructionson how to calculate similar stats for other frameworks. - On final classes in PHP.
- The fastest template engine for PHP.
- Unit test naming conventions.
📺 Videos
- PHP Russia 2020 Online videos.
- How to generate and view code coverage reports in PhpStorm using PHPUnit and Xdebug.
🔈 Podcasts
- Voices of the ElePHPant — Interview with Nuno Maduro.
- PHP Internals News Podcast by Derick Rethans
• #58 — With Max Semenik on the accepted RFC non-capturing catches.
• #57 — With Ralph Schindler on his proposal about conditional return, break, and continue statements.
• #56 — With Dan Ackroyd on the newly added mixed pseudotype.
Thanks for reading!
If you have any interesting or useful links to share via PHP Annotated, please leave a comment on this post or send me a tweet.
Your JetBrains PhpStorm team
The Drive to Develop