A modern WordPress stack for development tools and project structures

A modern WordPress stack for development tools and project structures

2022-10-12 0 1,017
Resource Number 45232 Last Updated 2025-02-24
¥ 0USD Upgrade VIP
Download Now Matters needing attention
Can't download? Please contact customer service to submit a link error!
Value-added Service: Installation Guide Environment Configuration Secondary Development Template Modification Source Code Installation

The recommended Bedrock in this issue is a modern WordPress stack to help you get started with the best development tools and project structures.

A modern WordPress stack for development tools and project structures插图

Bedrock特征

    • Better folder structure
    • Use Composer for dependency management
    • Easily configure WordPress using environment specific files
    • Dotenv environment variable
    • Automatic loader for mu plugins (using regular plugins as mu plugins)

Enhanced security (using WP password bcrypt to separate web root and secure password)

Bedrock installation

1. Create a new project:

$ composer create-project roots/bedrock

2. Update the environment variable. env in the file. Wrap values that may contain non alphanumeric characters in quotation marks, otherwise they may be interpreted incorrectly</ p>

  • Database variables
DBNAME - Database Name
DB-USER - Database User
DB-PASSWORD - Database Password
DB_SOST - Alternatively, you can define DATABASE-URL to use DSN instead of the variables above (e.g. mysql://user: password@127.0.0.1 :3306/db_name)
  • WP-INV – Set as environment (development, staging, production)
  • WP.HOME – Full URL of WordPress homepage( https://example.com )
  • WP_SITEURL – The complete URL of WordPress, including subdirectories( https://example.com/wp )
  • AUTH_KEY, SECURE_AUTH_KEY, LOGGED_IN_KEY, NONCE_KEY, AUTH_SALT, SECURE_AUTH_SALT, LOGGED_IN_SALT,NONCE_SALT

3. web/app/themes/Add themes like adding a regular WordPress website

4. Set the document root directory on your network server to Bedrock’s web folder:/path/to/site/web/

5. Accessing WordPress administrators
https://example.com/wp/wp-admin/

Bedrock特征示例

1. WordPress template with modern development tools, simpler configuration, and improved folder structure

# Create a new Bedrock project
$ composer create-project roots/bedrock

# Add plugins with Composer
$ composer require wpackagist-plugin/safe-redirect-manager
$ composer require wpackagist-plugin/simple-page-ordering
$ composer require wpackagist-plugin/woocommerce

2. Better WordPress project structure

Bedrock’s organization is similar to putting WordPress in its own subdirectory, but with some improvements, including renaming wp-content/ to app/.

├── composer.json
├── config
│   ├── application.php
│   └── environments
│       ├── development.php
│       ├── staging.php
│       └── production.php
├── vendor
└── web
    ├── app
    │   ├── mu-plugins
    │   ├── plugins
    │   ├── themes
    │   └── uploads
    ├── wp-config.php
    ├── index.php
    └── wp

3. Dependency Management using Composer

Manage your WordPress installation and plugins with PHP dependency manager Composer. Composer will make development more reliable, help team collaboration, and help maintain better Git repositories.

4. Simple WordPress configuration

Use Dotenv for environment-specific profiles and environment variables.

5. Enhanced security

Isolate Web roots by wp-password-bcrypt to restrict access to non-Web files and more secure passwords.

Bedrock document

Documentation for the Roots project, including Acorn, Bedrock, Sage, and Trellis.

1.Acorn Docs

Acorn is a way to use Laravel components in WordPress.

Acorn brings elements of the Laravel ecosystem to any WordPress plugin or theme.

In short, Acorn provides a way to load Laravel application containers gracefully within WordPress, while respecting the WordPress lifecycle and template hierarchy.

< Using Composer to install Acorn

Install Acorn in a WordPress installation managed by Composer, for example using Bedrock:

$ composer require roots/acorn

We also recommend adding Acorn’s postAutoloadDump function to composer’s post-autoload-dump event composer.json:

"post-autoload-dump": [
  "Roots\\Acorn\\ComposerScripts::postAutoloadDump"
]

Server requirements:

Acorn has very few server requirements, mostly from WordPress and Laravel 8.

PHP > =7.3 or > = 8.0 < / p >

WordPress > = 5.4

BCMath PHP extension

Ctype PHP extension

File info PHP extension

JSON PHP extension

Mbstring PHP extension

Tagger PHP extension

XML PHP extension

2.Bedrock Docs

Bedrock is a WordPress template.

Install Bedrock with Composer

Create a new bedrock project:

$ composer create-project roots/bedrock

Multiple sites:

Bedrock is compatible with multi-site networks, but requires a mu-plugin installation on the root/multisite-url-fixer subdomain to ensure that the administrative urls work properly. Subdirectory installations do not require this plug-in, but they can be used well. From your Bedrock directory:

$ composer require  roots/multisite-url-fixer

3.Sage Docs

Sage is a WordPress starter theme.

< Installing Sage with Composer

Install Sage from your WordPress theme directory using Composer (your-theme-name is replaced with your theme name below) :

# From your WordPress themes directory, run:
$ composer create-project roots/sage  your-theme-name

To install the latest development version of Sage, dev-main add:

at the end of the command

$ composer create-project roots/sage your-theme-name dev-main

You must build theme assets in order to access your site. Failure to build the asset will result in an error:

The manifest [/path/to/sage/public/manifest.json] cannot be found.

Run the first build:

    • yarn runs installation dependencies from the subject directory
    • bud.config.js updates

with local development URL

  • yarn build – Compile assets

4.Trellis Docs

Trellis is a tool for creating WordPress Web servers and deploying WordPress sites.

Trellis allows you to create and manage production-ready, performance-optimized servers based on constantly improving best practices. Since you benefit from the community and experience of Roots, Trellis is the right way to self-host.

Install Trellis-cli

$ brew install roots/tap/trellis-cli

Create project:

To create a new project, first, select a descriptive name (and use it instead of the default name example.com). For convenience, we recommend the domain for this site.

$ trellis new  example.com

Or to explicitly set the site name and host, use the following command:

trellis new --name example.com --host  www.example.com ~/path/to/my/project

After creating the project, the folder structure of the Trellis project will look like this:

example.com/      # → Root folder for the  project
├── trellis/      # → Your server configuration (a customized install of Trellis)
└── site/         # → A Bedrock-based WordPress site
└── web/
├── app/  # → WordPress content directory (themes, plugins, etc.)
└── wp/   # → WordPress core (don't touch!  - managed by Composer)

Assuming you use the CLI, you will also automatically configure your first WordPress site based on the project folder (or the name and host provided). View the following files to see the basic site configuration:

  • trellis/group_vars/development/wordpress_sites.yml
  • trellis/group_vars/production/wordpress_sites.yml

Building an example with Bedrock

A modern WordPress stack for development tools and project structures插图1

A modern WordPress stack for development tools and project structures插图2

A modern WordPress stack for development tools and project structures插图3

A modern WordPress stack for development tools and project structures插图4

—END—

Open Source protocol: MIT License

资源下载此资源为免费资源立即下载
Telegram:@John_Software

Disclaimer: This article is published by a third party and represents the views of the author only and has nothing to do with this website. This site does not make any guarantee or commitment to the authenticity, completeness and timeliness of this article and all or part of its content, please readers for reference only, and please verify the relevant content. The publication or republication of articles by this website for the purpose of conveying more information does not mean that it endorses its views or confirms its description, nor does it mean that this website is responsible for its authenticity.

Ictcoder Free source code A modern WordPress stack for development tools and project structures https://ictcoder.com/kyym/a-modern-wordpress-stack-for-development-tools-and-project-structures.html

Share free open-source source code

Q&A
  • 1, automatic: after taking the photo, click the (download) link to download; 2. Manual: After taking the photo, contact the seller to issue it or contact the official to find the developer to ship.
View details
  • 1, the default transaction cycle of the source code: manual delivery of goods for 1-3 days, and the user payment amount will enter the platform guarantee until the completion of the transaction or 3-7 days can be issued, in case of disputes indefinitely extend the collection amount until the dispute is resolved or refunded!
View details
  • 1. Heptalon will permanently archive the process of trading between the two parties and the snapshots of the traded goods to ensure that the transaction is true, effective and safe! 2, Seven PAWS can not guarantee such as "permanent package update", "permanent technical support" and other similar transactions after the merchant commitment, please identify the buyer; 3, in the source code at the same time there is a website demonstration and picture demonstration, and the site is inconsistent with the diagram, the default according to the diagram as the dispute evaluation basis (except for special statements or agreement); 4, in the absence of "no legitimate basis for refund", the commodity written "once sold, no support for refund" and other similar statements, shall be deemed invalid; 5, before the shooting, the transaction content agreed by the two parties on QQ can also be the basis for dispute judgment (agreement and description of the conflict, the agreement shall prevail); 6, because the chat record can be used as the basis for dispute judgment, so when the two sides contact, only communicate with the other party on the QQ and mobile phone number left on the systemhere, in case the other party does not recognize self-commitment. 7, although the probability of disputes is very small, but be sure to retain such important information as chat records, mobile phone messages, etc., in case of disputes, it is convenient for seven PAWS to intervene in rapid processing.
View details
  • 1. As a third-party intermediary platform, Qichou protects the security of the transaction and the rights and interests of both buyers and sellers according to the transaction contract (commodity description, content agreed before the transaction); 2, non-platform online trading projects, any consequences have nothing to do with mutual site; No matter the seller for any reason to require offline transactions, please contact the management report.
View details

Related Article

make a comment
No comments available at the moment
Official customer service team

To solve your worries - 24 hours online professional service