# Playbook

**Here are some ready-mode scenarios - from one end to another - to help you setup things. All scenarios in these playbooks assume you have already setup a Magento module. If you don't have a module yet, you can follow the steps below.**

## Create a new module
Create a new module folder `app/code/YireoTraining/Example` and navigate to it.

Create a file `registration.php`:
```php
<?php
declare(strict_types=1);

use Magento\Framework\Component\ComponentRegistrar;

ComponentRegistrar::register(
    ComponentRegistrar::MODULE, 'YireoTraining_Example', __DIR__
);
```

Create a file `etc/module.xml`:
```xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="YireoTraining_Example">
        <sequence>
            <module name="LokiCheckout_Core"/>
        </sequence>
    </module>
</config>
```

Create a file `composer.json`:
```json
{
  "name": "yireo-training/magento2-example",
  "version": "0.0.1",
  "description": "Just an example",
  "type": "magento2-module",
  "require": {
    "loki-checkout/magento2-core": "^2.0",
    "magento/framework": "^103.0"
  },
  "license": [
    "OSL-3.0"
  ],
  "autoload": {
    "files": [
      "registration.php"
    ],
    "psr-4": {
      "YireoTraining\\Example\\": ""
    }
  }
}
```

All of this could be generated as well.

## Enable the module
```bash
bin/magento module:enable YireoTraining_Example
```

## Add other dependencies when ready
If you have more dependencies to your module, we recommend you to run the [Yireo_ExtensionChecker](https://github. tcom/yireo/Yireo_ExtensionChecker) to quickly find all dependencies:

```bash
bin/magento yireo_extensionchecker:scan --module YireoTraining_Example
bin/magento yireo_extensionchecker:suggest:composer-json YireoTraining_Example
bin/magento yireo_extensionchecker:suggest:module-xml YireoTraining_Example
```
