wordpress modern development

18
better! Do it

Upload: roman-vesely

Post on 22-Jan-2018

130 views

Category:

Software


0 download

TRANSCRIPT

Page 1: WordPress modern development

better!Do it

Page 2: WordPress modern development

After dozens projects based on WordPress I found I miss something important. This is the solution (or one among the others), but let's do some introduction at first...

Page 3: WordPress modern development

famous 5-minute installation

WP is famous because of its simplicity when even BFU can easily start a project (which is great). One can download a ZIP, decompress, upload, and start working. It has automatic updates and web based plugin/themes installation.Such a simple one-click-to-profit process may however lead to irregularities in the future.

Page 4: WordPress modern development

$ git init

We can start to use git to allow cooperation in dev team and also to prevent conflicts between develop and production environments. But how will the commits and pull requests look like? What about third-party dependencies?

Page 5: WordPress modern development

Too many files to handle.Manual upload through FTP?

Try to remember everything. There is also another dark side of this process...

Page 6: WordPress modern development
Page 7: WordPress modern development

$ composer init

Move on and start to use PHP package manager. What can be a package in WP world?Plugin, theme and even a WordPress core itself.

Page 8: WordPress modern development

https://github.com/WordPress/WordPress

https://wpackagist.org/

WP is not prepared for composer. To get plugins and themes we can thankfully use their mirror with composer.json files included. Problem is their installation destination - vendor folder by default, where WP doesn’t look.

Page 9: WordPress modern development

johnpbloch/wordpress

custom install paths

There is an unofficial mirror also for the WordPress core with composer.json file. WordPress’ dependencies are special types of packages, so we can change their destination thanks to the composer custom paths.

Page 10: WordPress modern development

wordpress-plugin

wordpress-theme

wordpress-muplugin

There is a plenty of custom packages types. Muplugin stands for must-use, a special type of a plugin that cannot be deactivated.

Page 11: WordPress modern development

$ composer create-project roots/bedrock project-name

Again, too much to remember. Bedrock is a boilerplate for your WP projects. It has all features we mentioned so far included. And adds something more...

Page 12: WordPress modern development

environments

wp-config.php → .env

wp-password-bcrypt md5 → bcrypt

Bedrock supports different configuration for more environments (development, testing, production, …). It also ships with a plugin that makes users’ passwords more secure (can be used also on a project which is not based on Bedrock).

Page 13: WordPress modern development

Part of composer.json file. You can see custom composer repository or custom install paths.

Page 14: WordPress modern development

Project structure and part of a configuration file.

Page 15: WordPress modern development

Deployment can be made via several tools like Trellis, ruby-based Capistrano or via ssh access with just two commands.

Page 16: WordPress modern development

1 project2+ repositories

You can split your project into (at least) two repositories. One with defined dependencies like WP core and third-party plugins. The second is for your custom theme. More might come when you develop your own plugins.

Page 17: WordPress modern development

+● Less amount of manual work● Cleaner repositories● Easier code review● Overview of dependencies and their versions -

composer.json

● Simplified deployment

-● Need to change old habits● Time to set a new routine● Automatic updates

Page 18: WordPress modern development

You can find me here

@rmnvsl