PHP code example of jeanmarcos / module-core-local-development
1. Go to this page and download the library: Download jeanmarcos/module-core-local-development library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
jeanmarcos / module-core-local-development example snippets
use Development\Core\Model\ProductionGuard;
class MyDevPlugin
{
public function __construct(
private readonly ProductionGuard $guard
) {}
public function aroundSomething(Subject $s, \Closure $proceed, ...$args)
{
if (!$this->guard->isEnabled()) {
return $proceed(...$args);
}
// dev-only behavior here
}
}
Core/
├── Model/
│ └── ProductionGuard.php # shared production-guard service
├── etc/
│ ├── adminhtml/
│ │ └── system.xml # declares the shared <tab id="development">
│ └── module.xml
├── composer.json
├── registration.php
└── README.md