• My local WordPress development environment

    My local WordPress development environment

    My local WordPress development environment is where I work on new websites, develop plugins and themes, and test changes and updates to existing websites before they go live. Before I give you an overview of my setup, I’ll briefly answer these questions which I have posed to members of the WordPress Portsmouth Meetup.

    Questions regarding local development environments

    Do you run local and/or staging copies of your live sites?

    Yes. I run local copies.

    Do you regularly backup your live sites and restore them to other environments?

    Yes, I regularly backup the live sites. But I only restore them to my local development environment when I need to make significant changes or work with the latest content.

    Do you develop enhancements to your sites in these environments?

    I develop all my enhancements in one or more local installations.

    Do you maintain the production environment and development environment and keep the content reconciled?

    It depends.

    Overview of my setup

    Here’s an overview of my setup.

    What’s your setup?

    • For my local development I run a custom WAMP stack on my Windows laptop.
    • I develop my code in PhpStorm, but also use other tools.
    • I use Git version control with my repositories ( public and private ) in GitHub. See Version control
    • I have multiple local installations of WordPress, in subdirectories of DocumentRoot.
    • Some installations are WordPress Multi Site; both subdomain and subdirectory versions.
    • I use custom domains and subdomains and connect using https with self certified SSL certificates.
    • Most of my plugins and themes are symlinked.
    • I export and import MySQL databases using phpMyAdmin.
    • I backup files from live sites using the hosting company’s facilities.
    • My live sites are hosted on SiteGround Cloud Hosting.

    What do you use it for?

    • I develop WordPress plugins and themes.
    • I build and/or maintain some sites for customers and family members.
    • I build and maintain my own sites; quite a few.
    • I sometimes debug problems with WordPress core, plugins and themes.
    • And may raise issues if I think it’s worthwhile.
    • I don’t often raise PR’s to fix the problems.
    • When reconciling content between local and live sites I may
      • either clone content, post by post, using my own plugin
      • or export/import a complete backup
      • or apply a mixture of methods

    What tools do you use?

    See Tools and Languages

    How do you do these tasks…

     backup/export, restore/import, reconcile, develop, test, debug, release?

    Backup/export

    1. Export the database using phpMyAdmin.
    2. Archive all files in public_html

    Restore/import

    1. Import the database using phpMyAdmin
    2. Manually set siteurl and home using phpMyAdmin
    3. Switch to local URLs using better-search-replace
    4. Unzip required files from the archive of public_html

    Reconcile

    I use my own plugin called oik-clone to reconcile content by pushing and/or pulling content between the local site and the live site(s).

    Develop, test, debug, release

    • I develop my code using PhpStorm.
    • Plugins that deliver blocks are built with wp-scripts.
    • I’ve installed wp-env in order to attempt to build Gutenberg, but not yet been successful with it.
    • I debug the PHP code locally using oik-bwtrace in preference to Xdebug
    • I debug JavaScript code in the browser using Chrome and React Developer Tools
    • Sometimes I write PHPUnit test cases.
    • If I have them, I run them.
    • I package my plugins and themes using custom scripts
      • including automatic translation into UK English and the bbboing language.
    • And deliver them:
      • using GitHub if you want the source code,
      • from oik-plugins.com for free plugins or themes
      • from wordpress.org by updating the SVN repository from the Git repo

    Why would you recommend your solution to others?

    I would recommend using a local development environment:

    • to anyone who has bespoke code they need to manage
    • for people who have complex content updates, especially if the changes need to be reviewed by others
    • to people whose business depends on the website operating correctly; eg ecommerce sites, event sites

    I wouldn’t suggest attempting to copy my environment verbatim.

    • My particular environment was cobbled together over a period of years.
    • It has some limitations.
    • I imagine that some of the more modern tools might be better for new starters.

    What are the pros and cons?

    Pros

    Pro – In situ PHPUnit testing

    Pro – I don’t have to start up virtual environments.

    Pro – I use self certified SSL certificates

    Cons

    Con – An accidentally run WordPress update can completely destroy a plugin’s Git repo.

    Con – I can’t easily run multiple versions of PHP

    Con – Uploaded image size versions are sometimes inaccessible.

    Anything else?

    Find out more looking at these pages.



    Published:

    Last updated:

    October 17, 2022

Categories

Tide times from tidetimes.org.uk

Tide Times & Heights for Langstone Harbour on
3rd December 2022
00:14 Low Tide ( 1.63m )
07:48 High Tide ( 4.37m )
12:45 Low Tide ( 1.66m )
20:18 High Tide ( 4.16m )

Tide times from tidetimes.org.uk

Tide Times & Heights for Northney on
3rd December 2022
00:18 Low Tide ( 1.32m )
07:51 High Tide ( 4.25m )
12:53 Low Tide ( 1.42m )
20:22 High Tide ( 4.03m )
WordPress version:6.1.1
Gutenberg version:14.6.0

Summary file