{"id":217,"date":"2023-11-11T20:26:00","date_gmt":"2023-11-11T20:26:00","guid":{"rendered":"https:\/\/www.mitango.app\/?p=217"},"modified":"2024-11-15T20:28:57","modified_gmt":"2024-11-15T20:28:57","slug":"wordpress-plugin-bored-repeating-yourself-try-to-use-a-framework","status":"publish","type":"post","link":"https:\/\/www.mitango.app\/fr\/2023\/11\/11\/wordpress-plugin-bored-repeating-yourself-try-to-use-a-framework\/","title":{"rendered":"WordPress plugin: Bored repeating yourself? Try to use a framework"},"content":{"rendered":"<p><a href=\"https:\/\/medium.com\/@crochetfeve0251?source=post_page---byline--512214bfe350--------------------------------\" target=\"_blank\" rel=\"noopener\"><\/a><\/p>\n\n\n\n<p id=\"b0fa\">As a developer the most boring thing that can happen in your job is repeating ourselves again and again. Any programmer is learning eagerer and this is often moment when nothing new is learned.<\/p>\n\n\n\n<p id=\"6a26\">The issue with developing WordPress plugin is that at the start of any new plugin implementation there is always a base to rebuild which is exactly the same code from a project to another minus the name of the project forcing us to repeat ourselves before we even started.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"2f1a\">The issue with boilerplates<\/h2>\n\n\n\n<p id=\"ea31\">The most common solution used while facing that issue by developers is to tackle it using generated code which create that base for them and that could be an excellent solution but you might guess that if we are here talking about another solution they also bring drawbacks.<\/p>\n\n\n\n<p id=\"bf5b\">The biggest issue with boilerplates is that is not a recent solution and since then PHP evolved but boilerplates didn\u2019t or really few. Therefore that created a conflict for any developer that would like to use modern standards as their architecture is not compatible with modern pattern or technologies.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"a332\">The era of frameworks<\/h2>\n\n\n\n<p id=\"b264\">To face modern problem we need modern solutions.<\/p>\n\n\n\n<p id=\"6c58\">In the modern days boilerplates faded away in favor of frameworks which are easier to evolve and maintain. Due to that particular requirement frameworks are build around package managers and more particularly Composer in PHP.<\/p>\n\n\n\n<p id=\"8865\">This compatibility to Composer also open the door an easy management of third-party vendors which also enhance the don\u2019t repeat yourself philosophy.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"0270\">The vision behind Launchpad<\/h2>\n\n\n\n<p id=\"b146\">As you might notice Launchpad ships by default with the minimum features to run and nothing more.<\/p>\n\n\n\n<p id=\"9148\">This is something wanted and desired. Today WordPress is a slow solution so reducing as much as possible the footprint of the framework was an objective in order to prevent WordPress to become even slower technology.<\/p>\n\n\n\n<p id=\"a527\">The second reason behind that simplicity is the mantra:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p id=\"bde9\">Don\u2019t impose your solution but always propose a fallback.<\/p>\n<\/blockquote>\n\n\n\n<p id=\"6fff\">The idea behind that is that picking a framework is like marriage where you need to accept the constraints that goes with it. In order to make our user lives easier our job as a framework developers is to make the constraints as loose as possible.<\/p>\n\n\n\n<p id=\"cce3\">In that purpose, we would only impose the strict minimum for the framework to work to them and give them the opportunity to develop their own solutions for anything that is outside this scope by adopting a modular architecture.<\/p>\n\n\n\n<p id=\"c59b\">However just shipping the bare minimum is not enough as most of users are often seeking a quick fix. That\u2019s why it is important to provide a set of default modules for handling most common usages.<\/p>\n\n\n\n<p id=\"be51\">For Launchpad the default modules focus on 6 mains topics:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Asynchronous code to delay or spread operations over time.<\/li>\n\n\n\n<li>Database interaction to make it easier.<\/li>\n\n\n\n<li>Logging to keep a trace of critical operations.<\/li>\n\n\n\n<li>Filesystem to interact with files.<\/li>\n\n\n\n<li>Front-end to create the visual part of your plugin easier.<\/li>\n\n\n\n<li>Uninstall to keep the uninstallation simple.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"3693\">Try Launchpad<\/h2>\n\n\n\n<p id=\"d082\">To try Launchpad, you just have to run the following command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">composer create-project wp-launchpad\/launchpad my-plugin<\/pre>\n\n\n\n<p id=\"2e35\">This will create the default template for your project and you will be able to initialize it with the following command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">bin\/generator initialize<\/pre>\n\n\n\n<p id=\"80ba\">Once this is done your plugin is now ready to help you in your new adventures.<\/p>\n\n\n\n<p id=\"eca7\">If you want to know futher about Launchpad feel free to check&nbsp;<a href=\"https:\/\/wp-launchpad.gitbook.io\/launchpad\/\" rel=\"noreferrer noopener\" target=\"_blank\">its documentation<\/a>&nbsp;or its&nbsp;<a href=\"https:\/\/github.com\/wp-launchpad\/launchpad\" rel=\"noreferrer noopener\" target=\"_blank\">Github repository<\/a>.<\/p>","protected":false},"excerpt":{"rendered":"<p>As a developer the most boring thing that can happen in your job is repeating ourselves again and again. Any programmer is learning eagerer and this is often moment when nothing new is learned.<\/p>\n<p>The issue with developing WordPress plugin is that at the start of any new plugin implementation there is always a base to rebuild which is exactly the same code from a project to another minus the name of the project forcing us to repeat ourselves before we even started.<\/p>","protected":false},"author":1,"featured_media":218,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2}},"categories":[18],"tags":[19,20,57,5,49],"class_list":["post-217","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wordpress","tag-php","tag-plugin-development","tag-plugins-for-wordpress","tag-wordpress","tag-wordpress-development"],"jetpack_publicize_connections":[],"acf":[],"_links":{"self":[{"href":"https:\/\/www.mitango.app\/fr\/wp-json\/wp\/v2\/posts\/217","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mitango.app\/fr\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mitango.app\/fr\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mitango.app\/fr\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mitango.app\/fr\/wp-json\/wp\/v2\/comments?post=217"}],"version-history":[{"count":1,"href":"https:\/\/www.mitango.app\/fr\/wp-json\/wp\/v2\/posts\/217\/revisions"}],"predecessor-version":[{"id":219,"href":"https:\/\/www.mitango.app\/fr\/wp-json\/wp\/v2\/posts\/217\/revisions\/219"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.mitango.app\/fr\/wp-json\/wp\/v2\/media\/218"}],"wp:attachment":[{"href":"https:\/\/www.mitango.app\/fr\/wp-json\/wp\/v2\/media?parent=217"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mitango.app\/fr\/wp-json\/wp\/v2\/categories?post=217"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mitango.app\/fr\/wp-json\/wp\/v2\/tags?post=217"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}