Download the PHP package rbdwllr/atlantic-city without Composer
On this page you can find all versions of the php package rbdwllr/atlantic-city. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download rbdwllr/atlantic-city
More information about rbdwllr/atlantic-city
Files in rbdwllr/atlantic-city
Package atlantic-city
Short Description A replica of the default WordPress plugin Hello Dolly, but for composer powered WordPress and for the song Atlantic City.
License MIT
Informations about the package atlantic-city
Atlantic City
A Composer based WordPress plugin which displays lyrics from the song Atlantic City in the WordPress admin.
This plugin was created to show developers how to create WordPress plugins which are hosted on Packagist and work with Composer friendly WordPress frameworks like Dusty.
It also highlights how to write unit tests for WordPress plugins using WP_Mock and how to integrate with static analysis tools like PHPStan.
Composer Setup
There is only one difference between a WordPress plugin built with Composer compared to a standard PHP package, which is the package type. With WordPress plugins you set the type to wordpress-plugin
in the Composer.json file.
This simply tells Composer friendly WordPress frameworks how to handle the package, instead of putting the package in the vendor folder it will put the package in the WordPress plugins directory. See WPackagist for more details on this.
Unit Tests with WP_Mock
To write unit tests for WordPress you need to use a package called WP_Mock. It is an extension of PHP Unit which allows you to mock WordPress custom function calls.
For instance this library's unit tests mock the is_rtl()
function which tells WordPress if the site's text runs from right to left or left to right.
To use WP_Mock you need to create a custom bootstrap file and extend the WP_Mock test case class rather than the PHP Unit one.
WP_Mock also comes with some nice features which allow you to check whether WordPress actions or filters have been called.
Other Code Analysis Tools
This plugin integrates with a number of static analysis tools, including PHP Code Sniffer and PHP Mess Detection, which will help improve the code quality of the WordPress plugins you produce.
It also shows you how to integrate with PHPStan to add some type safety to your code. This requires a small amount of customisation to handle WordPress so there is a szepeviktor/phpstan-wordpress package which extends PHPStan for WordPress.