/magento_version
```
```text
Magento/2.3 (Community)
```
--------------------------------
### Enable a component
Source: https://github.com/adobedocs/commerce-php/blob/main/src/pages/development/build/component-management.md
Use this command to enable a component and clear static content. Ensure you run setup:upgrade and cache:clean afterward.
```bash
bin/magento module:enable --clear-static-content Component_Name
```
--------------------------------
### InstallSchema.php for Schema Initialization
Source: https://github.com/adobedocs/commerce-php/blob/main/src/pages/development/prepare/extension-lifecycle.md
Implement this class to execute code during your module's initial schema installation. The application skips this stage if the schema version is already present in the setup_module table.
```php
slowLoading = $slowLoading;
}
public function getFastValue()
{
return 'FastLoading value';
}
public function getSlowValue()
{
return $this->slowLoading->getValue();
}
}
```
--------------------------------
### Example Language Package Registration
Source: https://github.com/adobedocs/commerce-php/blob/main/src/pages/development/build/component-registration.md
This is an example of registering the German language package for Magento.
```php
use Magento\nFramework\nComponent\nComponentRegistrar;
ComponentRegistrar::register(ComponentRegistrar::LANGUAGE, 'magento_de_de', __DIR__);
```
--------------------------------
### Module File Structure Overview
Source: https://github.com/adobedocs/commerce-php/blob/main/src/pages/development/build/component-file-structure.md
Illustrates a typical file structure for a module, including common directories for block, controller, configuration, model, and setup classes.
```tree
├── Block
├── Controller
├── etc
├── Model
│ ├── ResourceModel
│ └── Collection
├── Setup
└── ViewModel
```
--------------------------------
### Test GET Endpoint Response
Source: https://github.com/adobedocs/commerce-php/blob/main/src/pages/tutorials/backend/create-custom-rest-api.md
This is a sample JSON response for a GET request to retrieve product details.
```json
{
"id": 1,
"sku": "24-MB01",
"name": "Joust Duffle Bag",
"description": "The sporty Joust Duffle Bag can't be beat - not in the gym, not on the luggage carousel, not anywhere. Big enough to haul a basketball or soccer ball and some sneakers with plenty of room to spare, it's ideal for athletes with places to go.
\n
\n- Dual top handles.
\n- Adjustable shoulder strap.
\n- Full-length zipper.
\n- L 29\" x W 13\" x H 11".
\n
"
}
```
--------------------------------
### Minimal module.xml for component declaration
Source: https://github.com/adobedocs/commerce-php/blob/main/src/pages/development/build/component-name.md
Declare your component's name and existence in the `module.xml` file. The `name` parameter is mandatory. Include `setup_version` if not using Declarative Schema.
```xml
```
--------------------------------
### Configure Performance Monitor
Source: https://github.com/adobedocs/commerce-php/blob/main/src/pages/module-reference/module-application-performance-monitor.md
Add these lines to `app/etc/env.php` to enable and configure the performance monitor. Use 0 or 1 to enable or disable.
```php
'application' => [
'performance_monitor' => [
'logger_output_enable' => 1,
'logger_output_verbose' => 0,
]
]
```
--------------------------------
### Example of a Poorly Named Command
Source: https://github.com/adobedocs/commerce-php/blob/main/src/pages/development/cli-commands/naming-guidelines.md
This example demonstrates a command name that is not obvious and difficult to remember due to its structure.
```terminal
myname:dev:theme:create
```
--------------------------------
### Instantiate Object with Default Dependencies
Source: https://github.com/adobedocs/commerce-php/blob/main/src/pages/development/components/object-manager/helper.md
Use this to create an object with all its dependencies automatically mocked by the helper class.
```php
$objectManagerHelper = new \Magento\TestFramework\Helper\ObjectManager($this);
// default constructor arguments
$scopePool = $objectManagerHelper->getObject('\Magento\App\Config\ScopePool');
```
--------------------------------
### Example Method DocBlock
Source: https://github.com/adobedocs/commerce-php/blob/main/src/pages/coding-standards/docblock.md
Illustrates the correct structure and content for a method DocBlock, including descriptions, parameter, return, and exception annotations.
```php
/**
* Merge the config XML files
*
* @param array $configFiles
* @return void
* @throws \Magento\Exception if a non-existing or invalid XML file passed
*/
protected function merge($configFiles)
{
$domConfig = new \Magento\Config\Dom($this->_getInitialXml(), $this->_getIdAttributes());
foreach ($configFiles as $file) {
if (!file_exists($file)) {
throw new \Magento\Exception("File does not exist: {$file}");
}
$domConfig->merge(file_get_contents($file));
if (!$domConfig->validate($this->getSchemaFile(), $errors)) {
$message = "Invalid XML file: {$file}\n";
/** @var libXMLError $error */
foreach ($errors as $error) {
$message .= "{$error->message} Line: {$error->line}\n";
}
throw new \Magento\Exception($message);
}
}
$this->_dom = $domConfig->getDom();
}
```
--------------------------------
### Install OpenSwoole PHP Extension
Source: https://github.com/adobedocs/commerce-php/blob/main/src/pages/module-reference/module-application-server.md
Install the OpenSwoole PHP extension and its corresponding Composer package. Ensure you use compatible versions.
```bash
pecl install openswoole-22.0.0 | composer require openswoole/core:22.1.1
```
--------------------------------
### Deploy Sample Data using Magento CLI
Source: https://github.com/adobedocs/commerce-php/blob/main/src/pages/module-reference/module-sample-data.md
Use this command to deploy sample data packages from the Magento composer repository via the Magento command-line interface.
```bash
composer install
```
```bash
bin/magento sampledata:deploy
```
--------------------------------
### Test GET Endpoint Request
Source: https://github.com/adobedocs/commerce-php/blob/main/src/pages/tutorials/backend/create-custom-rest-api.md
Use this format to test a GET endpoint. Replace placeholders with your domain, store code, and product ID.
```http
GET /rest/V1//rest_dev/getProduct/
```
--------------------------------
### DocBlock for Implementation
Source: https://github.com/adobedocs/commerce-php/blob/main/src/pages/coding-standards/docblock.md
Example of a DocBlock for a class implementation, mirroring interface documentation.
```php