{"id":26682971,"url":"https://github.com/dark-kitt/wordpress-boilerplate","last_synced_at":"2025-03-26T08:28:46.510Z","repository":{"id":225293441,"uuid":"764579282","full_name":"dark-kitt/wordpress-boilerplate","owner":"dark-kitt","description":"This Composer configuration sets up a base project structure, that includes a WordPress backend with a configuration plugin and a custom base theme.","archived":false,"fork":false,"pushed_at":"2024-04-29T08:29:00.000Z","size":82,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-08-23T17:55:09.106Z","etag":null,"topics":["acf","apache","composer","composer-project","composer-scripts","composer2","hooks","jwt-authentication","mariadb","mysql","php","php8","rest-api","wordpress","wordpress6"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc-by-sa-4.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dark-kitt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-28T10:37:21.000Z","updated_at":"2024-04-29T08:29:04.000Z","dependencies_parsed_at":"2024-03-01T09:25:24.182Z","dependency_job_id":"ed7fbd4e-19a5-417b-b5dd-4112b09b45cf","html_url":"https://github.com/dark-kitt/wordpress-boilerplate","commit_stats":null,"previous_names":["dark-kitt/wordpress-boilerplate"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dark-kitt%2Fwordpress-boilerplate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dark-kitt%2Fwordpress-boilerplate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dark-kitt%2Fwordpress-boilerplate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dark-kitt%2Fwordpress-boilerplate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dark-kitt","download_url":"https://codeload.github.com/dark-kitt/wordpress-boilerplate/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245617909,"owners_count":20644896,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["acf","apache","composer","composer-project","composer-scripts","composer2","hooks","jwt-authentication","mariadb","mysql","php","php8","rest-api","wordpress","wordpress6"],"created_at":"2025-03-26T08:28:45.397Z","updated_at":"2025-03-26T08:28:46.502Z","avatar_url":"https://github.com/dark-kitt.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# **WordPress Boilerplate**\nProject: [**Part 1**](https://github.com/dark-kitt/wordpress-boilerplate/tree/main), [Part 2](https://github.com/dark-kitt/wordpress-theme-configuration), [Part 3](https://github.com/dark-kitt/wordpress-theme-vue)\n\n---\n\n## Introduction\n\nThis Composer configuration sets up a base project structure, that includes a WordPress backend with a configuration plugin and a custom base theme.\n\nWhile setting up the project, Composer creates a copy of a **[base Vue.js theme](https://github.com/dark-kitt/wordpress-theme-vue)** (*`app/themes/wordpress-theme-vue`*) with the same name as the root directory. Use the **`.env`** file in the root directory to define the environment variables and configure the backend system with the [**configuration plugin methods**](https://github.com/dark-kitt/wordpress-theme-configuration) (*`app/mu-plugin/wordpress-theme-configuration`*), as usual, inside of the **`functions.php`** file, that is located in the theme directory.\n\nAdditionally, to load MU-Plugins from subdirectories Composer adds an **[autoloader for MU-Plugins](https://github.com/dark-kitt/wordpress-mu-plugin-autoloader)** (*`app/mu-plugin/wordpress-mu-plugin-autoloader.php`*). WordPress only looks for PHP files right inside the MU-Plugins directory, and not for files in subdirectories (unlike for normal plugins).\n\nNote: Useful plugins and Composer scripts are available or editable inside the **`composer.json`** file.\n\n### Requirements\n\n* [Composer: ^2.*](https://getcomposer.org/download/)\n* [PHP: ^7.*](https://www.php.net/manual/de/mysql-xdevapi.installation.php)\n* [Maria DB: ^10.*](https://mariadb.com/) || [MySQL: ^8.*](https://www.mysql.com/)\n* [Apache: ^2.4.*](https://httpd.apache.org/)\n\n⚠️ **ACF Pro** ⚠️\n\nIf you want to use ACF Pro and have an **existing key**, please update the `\"dist\": {.. \"url\": \"https:..\u0026k=\u003c\u003cACF_KEY\u003e\u003e..\" }` key inside of the composer.json file (~[**25,89**]). Replace **`\u003c\u003cACF_KEY\u003e\u003e`** with your own key. If you **won't use ACF Pro**, you can delete the ACF Pro requirements with:\n```shell\ncomposer config --unset repositories.advanced-custom-fields/advanced-custom-fields-pro \u0026\u0026 composer remove advanced-custom-fields/advanced-custom-fields-pro\n```\n\n**Maria DB**\n\nThe requirements for the database are defined in the **`.env`** file. WordPress creates the **database** automatically if the database does not exist. Otherwise, **WordPress** loads the existing database.\n\n**WordPress Salts**\n\nThe WordPress Salts in the **`.env`** file are fetched and placed automatically, for `each project/installation`.\n\n**JWT Authentication**\n\nThe secret key in the **`.env`** file for JWT Authentication for WP REST API is created and placed automatically, for `each project/installation`.\n\nNote: It is optional to use the **custom WordPress REST API** from the [wordpress-theme-configuration](https://github.com/dark-kitt/wordpress-theme-configuration) MU-Plugin.\n\n**Docker**\n\nIf you need a tiny Docker setup to test the project, checkout my [Docker PHP:8.2-Apache MySQL](https://github.com/dark-kitt/docker-php-apache-mysql) repo.\n\n**Custom Hooks**\n\nTo work with the custom hook directory, you need to set the **`hooksPath`** inside the **`git config`**, after each clone. To do so, you need to call the following command. Afterward, you can work with custom GutHub hooks inside the *`./hooks`* directory.\n```shell\ngit config core.hooksPath hooks\n```\n\n**Getting Started!**\n\nIf you need an example project to work with this configuration, please checkout my [**Getting Started!**](https://github.com/dark-kitt/wordpress-theme-vue/tree/main?tab=readme-ov-file#getting-started) in [Part 3](https://github.com/dark-kitt/wordpress-theme-vue).\n\n---\n\n## Installation\n\nCopy or fetch the **`composer.json`** file in your project root directory and run **composer update** to generate the required ***composer.lock*** file. Or install all the required files with the command **composer install** in your terminal, if the composer.lock file already exists. After the installation is done, edit the ***.env*** and ***.htaccess*** file and start creating your custom WordPress theme.\n\n* copy-paste or fetch the ***composer.json*** file in your project root directory\n* run **composer update** or **composer install** to generate the required files\n* set up ***.env*** variables and the `KITT_TLD` and `KITT_SLD` constants in the ***.htaccess*** file\n\nTo fetch the ***composer.json*** file directly in your project root directory, you can use the following curl command.\n```shell\ncurl --header \"PRIVATE-TOKEN: \u003cgithub_access_token\u003e\" \"https://raw.githubusercontent.com/dark-kitt/wordpress-boilerplate/main/composer.json\" \u003e composer.json\n```\nOr save your private access token in a curl header file, e.g. *`~/.curl/github`* and include your specific header into your command.\n```text\n# ~/.curl/github\nPRIVATE-TOKEN: \u003cgithub_access_token\u003e\n```\n```shell\ncurl -H @\"$HOME/.curl/github\" \"https://raw.githubusercontent.com/dark-kitt/wordpress-boilerplate/main/composer.json\" \u003e composer.json\n```\n\n**common composer cmds**\n```shell\ncomposer install\ncomposer update\n# package control\ncomposer require verdor/package\ncomposer remove verdor/package\n\n# add / remove repositories (type = vcs, composer ... etc)\ncomposer config repositories.verdor/package type https://example.com/verdor/package.git\ncomposer config --unset repositories.verdor/package\n\ncomposer clear-cache\ncomposer show -i (installed packages)\n```\n\n**example vhosts.conf**\n```apacheconf\n# Tiny example vhosts config file\n\u003cVirtualHost *:80\u003e\n  ServerName api.example.kitt\n  ServerAlias www.api.example.kitt\n  ServerAdmin webmaster@localhost\n\n  DocumentRoot /var/www/html/web\n  \u003cDirectory /var/www/html/web\u003e\n    Options Indexes FollowSymlinks\n    AllowOverride All\n    Require all granted\n  \u003c/Directory\u003e\n\n  ErrorLog ${APACHE_LOG_DIR}/error.log\n  CustomLog ${APACHE_LOG_DIR}/access.log combined\n\u003c/VirtualHost\u003e\n\n\u003cVirtualHost *:80\u003e\n  ServerName example.kitt\n  ServerAlias www.example.kitt\n  ServerAdmin webmaster@localhost\n\n  DocumentRoot /var/www/html/web/app/themes\n  \u003cDirectory /var/www/html/web/app/themes\u003e\n    Options Indexes FollowSymlinks\n    AllowOverride All\n    Require all granted\n  \u003c/Directory\u003e\n\n  ErrorLog ${APACHE_LOG_DIR}/error.log\n  CustomLog ${APACHE_LOG_DIR}/access.log combined\n\u003c/VirtualHost\u003e\n# Create custom local domain HTTPS\n# NOTE: mkcert is required\n# https://github.com/FiloSottile/mkcert\n# Create ./ssl directory and run inside =\u003e mkcert localhost 127.0.0.1 ::1 example.kitt \\*.example.kitt\n# Add the new certificates =\u003e mkcert -install\n# Don't forget to set up the local /etc/hosts file =\u003e 127.0.0.1 example.kitt api.example.kitt\n# \u003cVirtualHost *:443\u003e\n#   # example.kitt:8443\n#   ServerName example.kitt\n#   ServerAlias www.example.kitt\n\n#   SSLEngine on\n#   SSLCertificateFile /var/www/html/ssl/cert.pem\n#   SSLCertificateKeyFile /var/www/html/ssl/key.pem\n\n#   ServerAdmin webmaster@localhost\n#   DocumentRoot /var/www/html/web/app/themes\n\n#   ErrorLog ${APACHE_LOG_DIR}/error.log\n#   CustomLog ${APACHE_LOG_DIR}/access.log combined\n# \u003c/VirtualHost\u003e\n\n# \u003cVirtualHost *:443\u003e\n#   # api.example.kitt:8443\n#   ServerName api.example.kitt\n#   ServerAlias www.api.example.kitt\n\n#   SSLEngine on\n#   SSLCertificateFile /var/www/html/ssl/cert.pem\n#   SSLCertificateKeyFile /var/www/html/ssl/key.pem\n\n#   ServerAdmin webmaster@localhost\n#   DocumentRoot /var/www/html/web\n\n#   ErrorLog ${APACHE_LOG_DIR}/error.log\n#   CustomLog ${APACHE_LOG_DIR}/access.log combined\n# \u003c/VirtualHost\u003e\n```\n\n---\n\n## .env\n\nReplace the existing default values with your specific project configuration. The **WordPress Salts** and the secret key for **JWT Authentication for WP REST API** are created and placed automatically (keys for each installation).\n\nNote: The secret key for **JWT Authentication for WP REST API** is required for the **custom WordPress REST API** [wordpress-theme-configuration](https://github.com/dark-kitt/wordpress-theme-configuration) MU-Plugin. If you won't use the **custom WordPress REST API** Method from the **wordpress-theme-configuration** MU-Plugin, you can ignore the secret key or use it on your own.\n\nNote: Additionally, if you use the example Apache configuration above `WP_HOME` (http://example.dev) can not be equal to `WP_SITEURL` (http://api.example.dev/wp), because of the custom WordPress REST API, which is defined by the [wordpress-theme-configuration](https://github.com/dark-kitt/wordpress-theme-configuration) MU-Plugin. The `ENV_SITEURL` (http://api.example.dev/) constant is used to configure other additional stuff.\n\nDon't forget to edit the ***.htacces*** file (`KITT_TLD` and `KITT_SLD` constants).\n\nNote: The `WP_DEBUG_LOG` constant is set to `/storage/logs/wp_error.log`. If you use **Docker** and want to see the `WordPress error logs` after you called the `docker logs -f \u003ccontainer\u003e \u003e/dev/null` command for php logs. Set the path to `/dev/stderr` and the WordPress error logs should be visible.\n\n---\n\n## Scripts\n\n```shell\ncomposer htpasswd-www\n```\nor\n```shell\ncomposer htpasswd-web\n```\n\nThe htpasswd-www or htpasswd-web script adds a ***.htpasswd*** file in the *`/www`* directory of the theme or in the *`/web`* directory of this project. Additionally, the scripts will also add a ***.htacces*** file with the required information to each directory, if it doesn't exist. If it exists **`htpasswd-www`** or **`htpasswd-web`** will only add the required information **at the end** of the file.\n\nTo edit the **user** and the **password** information, open the composer.json file and replace **user** and **password** with your specific login data inside of the **`htpasswd-www`** ([**145,135**]) or **`htpasswd-web`** ([**140,79**]) script.\n\nNote: Don't push your ***.htpasswd*** and ***.htacces*** files with your local **AuthUserFile** information to the live server.\n\n---\n\n```shell\ncomposer set-up-project\n```\n\nset-up-project creates *`.env`*, *`./web/index.php`*, *`./web/wp-config.php`*, *`./web/.htaccess`*, *`./web/media`*, *`./web/storage`*, *`./web/storage/cache`*, *`./web/storage/logs`* and *`./web/storage/lang`*, if they are don't exists. Additionally, the script will execute the **clear-base-theme**, **clear-theme-configuration** and **clear-mu-autoloader** scripts, if the plugins are installed.\n\n---\n\n```shell\ncomposer default-env-file\n```\n\ncreates the default ***.env*** in the root directory of this project. Note: If a ***.env*** file already exists, this script will overwrite the existing one.\n\n---\n\n```shell\ncomposer default-index-file\n```\n\ncreates the default ***index.php*** file in the *`/web/`* directory of this project. Note: If an ***index.php*** file already exists, this script will overwrite the existing one.\n\n---\n\n```shell\ncomposer default-wp-config-file\n```\n\ncreates the default ***wp-config.php*** file in the *`/web/`* directory of this project. Note: If a ***wp-config.php*** file already exists, this script will overwrite the existing one.\n\n---\n\n```shell\ncomposer default-htaccess-file\n```\n\ncreates the default ***.htaccess*** file in the *`/web/`* directory of this project. Note: If a ***.htaccess*** file already exists, this script will overwrite the existing one.\n\n---\n\n```shell\ncomposer default-base-theme-files\n```\n\ncopies the **[base Vue.js theme](https://github.com/dark-kitt/wordpress-theme-vue)** in the same directory (*`app/themes/$name`*) with the name as the root directory. Afterwards, it creates all necessary default files for WordPress if they don't already exist.\n\n---\n\n```shell\ncomposer clear-base-theme\n```\n\ndeletes all **Git** and **Composer** data in the copy of the **[base Vue.js theme](https://github.com/dark-kitt/wordpress-theme-vue)** directory (*`app/themes/$name`*) if they exist.\n\n---\n\n```shell\ncomposer clear-mu-autoloader\n```\n\ndeletes the **[Autoloader MU-Plugin](https://github.com/dark-kitt/wordpress-mu-plugin-autoloader)** in the *`app/mu-plugin`* directory, but **not** the *`mu-plugin-autoloader.php`* file in the same directory.\n\n---\n\n```shell\ncomposer clear-theme-configuration\n```\n\ndeletes all **Git** and **Composer** data in the *`app/mu-plugin/wordpress-theme-configuration`* directory if they exist.\n\n---\n---\n\n## License\n\n[![](https://upload.wikimedia.org/wikipedia/commons/e/e5/CC_BY-SA_icon.svg)](https://creativecommons.org/licenses/by-sa/4.0)\n\n---\n\n## Includes\n\n* [Roots / WordPress](https://github.com/roots/wordpress)\n* [Roots / wp-password-bcrypt](https://github.com/roots/wp-password-bcrypt)\n* [PHP dotenv](https://github.com/vlucas/phpdotenv)\n* [Advanced Custom Fields: Pro](https://www.advancedcustomfields.com/pro/)\n* [Advanced Custom Fields: Extended](https://wordpress.org/plugins/acf-extended/)\n* [JWT Authentication for WP REST API](https://wordpress.org/plugins/jwt-authentication-for-wp-rest-api/)\n* [dark-kitt / wordpress-theme-vue](#)\n* [dark-kitt / wordpress-theme-configuration](#)\n* [dark-kitt / wordpress-wp-mu-plugin-autoloader](#)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdark-kitt%2Fwordpress-boilerplate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdark-kitt%2Fwordpress-boilerplate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdark-kitt%2Fwordpress-boilerplate/lists"}