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,374
Resource Number 45232 Last Updated 2025-02-24
¥ 0HKD 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/a-modern-wordpress-stack-for-development-tools-and-project-structures/

Share free open-source source code

Q&A
  • 1. Automatic: After making an online payment, click the (Download) link to download the source code; 2. Manual: Contact the seller or the official to check if the template is consistent. Then, place an order and make payment online. The seller ships the goods, and both parties inspect and confirm that there are no issues. ICTcoder will then settle the payment for the seller. Note: Please ensure to place your order and make payment through ICTcoder. If you do not place your order and make payment through ICTcoder, and the seller sends fake source code or encounters any issues, ICTcoder will not assist in resolving them, nor can we guarantee your funds!
View details
  • 1. Default transaction cycle for source code: The seller manually ships the goods within 1-3 days. The amount paid by the user will be held in escrow by ICTcoder until 7 days after the transaction is completed and both parties confirm that there are no issues. ICTcoder will then settle with the seller. In case of any disputes, ICTcoder will have staff to assist in handling until the dispute is resolved or a refund is made! If the buyer places an order and makes payment not through ICTcoder, any issues and disputes have nothing to do with ICTcoder, and ICTcoder will not be responsible for any liabilities!
View details
  • 1. ICTcoder will permanently archive the transaction process between both parties and snapshots of the traded goods to ensure the authenticity, validity, and security of the transaction! 2. ICTcoder cannot guarantee services such as "permanent package updates" and "permanent technical support" after the merchant's commitment. Buyers are advised to identify these services on their own. If necessary, they can contact ICTcoder for assistance; 3. When both website demonstration and image demonstration exist in the source code, and the text descriptions of the website and images are inconsistent, the text description of the image shall prevail as the basis for dispute resolution (excluding special statements or agreements); 4. If there is no statement such as "no legal basis for refund" or similar content, any indication on the product that "once sold, no refunds will be supported" or other similar declarations shall be deemed invalid; 5. Before the buyer places an order and makes payment, the transaction details agreed upon by both parties via WhatsApp or email can also serve as the basis for dispute resolution (in case of any inconsistency between the agreement and the description of the conflict, the agreement shall prevail); 6. Since chat records and email records can serve as the basis for dispute resolution, both parties should only communicate with each other through the contact information left on the system when contacting each other, in order to prevent the other party from denying their own commitments. 7. Although the probability of disputes is low, it is essential to retain important information such as chat records, text messages, and email records, in case a dispute arises, so that ICTcoder can intervene quickly.
View details
  • 1. As a third-party intermediary platform, ICTcoder solely protects transaction security and the rights and interests of both buyers and sellers based on the transaction contract (product description, agreed content before the transaction); 2. For online trading projects not on the ICTcoder platform, any consequences are unrelated to this platform; regardless of the reason why the seller requests an offline transaction, please contact the administrator to report.
View details

Related Source code

ICTcoder Customer Service

24-hour online professional services