Skip to content

Commit

Permalink
Rename plugin files
Browse files Browse the repository at this point in the history
  • Loading branch information
loevgaard committed Sep 25, 2024
1 parent e4533ea commit e095f13
Show file tree
Hide file tree
Showing 22 changed files with 48 additions and 183 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ jobs:
- "highest"

symfony:
- "~5.4.0"
- "~6.4.0"

steps:
Expand Down Expand Up @@ -127,7 +126,6 @@ jobs:
- "highest"

symfony:
- "~5.4.0"
- "~6.4.0"

steps:
Expand Down Expand Up @@ -171,7 +169,6 @@ jobs:
- "highest"

symfony:
- "~5.4.0"
- "~6.4.0"

steps:
Expand Down Expand Up @@ -212,7 +209,6 @@ jobs:
- "highest"

symfony:
- "~5.4.0"
- "~6.4.0"

steps:
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2024 Acme
Copyright (c) 2024 Setono

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
54 changes: 10 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,53 +1,19 @@
# Setono Sylius Plugin Skeleton
# Age Verification Plugin for Sylius

[![Latest Version][ico-version]][link-packagist]
[![Software License][ico-license]](LICENSE)
[![Build Status][ico-github-actions]][link-github-actions]
[![Code Coverage][ico-code-coverage]][link-code-coverage]
[![Mutation testing][ico-infection]][link-infection]

[Setono](https://setono.com) have made a bunch of [plugins for Sylius](https://github.com/Setono?q=plugin&sort=stargazers), and we have some guidelines
which we try to follow when developing plugins. These guidelines are used in this repository, and it gives you a very
solid base when developing plugins.

Enjoy!
[ico-version]: https://poser.pugx.org/setono/sylius-age-verification-plugin/v/stable
[ico-license]: https://poser.pugx.org/setono/sylius-age-verification-plugin/license
[ico-github-actions]: https://github.com/Setono/sylius-age-verification-plugin/workflows/build/badge.svg
[ico-code-coverage]: https://codecov.io/gh/Setono/sylius-age-verification-plugin/branch/master/graph/badge.svg
[ico-infection]: https://img.shields.io/endpoint?style=flat&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2FSetono%2FSyliusPluginSkeleton%2Fmaster

## Quickstart

1. Run
```shell
composer create-project --prefer-source --no-install --remove-vcs setono/sylius-plugin-skeleton:1.12.x-dev ProjectName
```
or just click the `Use this template` button at the right corner of this repository.
2. Run
```shell
cd ProjectName && composer install
```
3. From the plugin skeleton root directory, run the following commands:

```bash
php init
(cd tests/Application && yarn install)
(cd tests/Application && yarn build)
(cd tests/Application && bin/console assets:install)
(cd tests/Application && bin/console doctrine:database:create)
(cd tests/Application && bin/console doctrine:schema:create)
(cd tests/Application && bin/console sylius:fixtures:load -n)
```

4. Start your local PHP server: `symfony serve` (see https://symfony.com/doc/current/setup/symfony_server.html for docs)

To be able to set up a plugin's database, remember to configure you database credentials in `tests/Application/.env` and `tests/Application/.env.test`.
[ico-version]: https://poser.pugx.org/setono/sylius-plugin-skeleton/v/stable
[ico-license]: https://poser.pugx.org/setono/sylius-plugin-skeleton/license
[ico-github-actions]: https://github.com/Setono/SyliusPluginSkeleton/workflows/build/badge.svg
[ico-code-coverage]: https://codecov.io/gh/Setono/SyliusPluginSkeleton/branch/1.12.x/graph/badge.svg
[ico-infection]: https://img.shields.io/endpoint?style=flat&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2FSetono%2FSyliusPluginSkeleton%2F1.12.x
[link-packagist]: https://packagist.org/packages/setono/sylius-plugin-skeleton
[link-github-actions]: https://github.com/Setono/SyliusPluginSkeleton/actions
[link-code-coverage]: https://codecov.io/gh/Setono/SyliusPluginSkeleton
[link-infection]: https://dashboard.stryker-mutator.io/reports/github.com/Setono/SyliusPluginSkeleton/1.12.x
[link-packagist]: https://packagist.org/packages/setono/sylius-age-verification-plugin
[link-github-actions]: https://github.com/Setono/sylius-age-verification-plugin/actions
[link-code-coverage]: https://codecov.io/gh/Setono/sylius-age-verification-plugin
[link-infection]: https://dashboard.stryker-mutator.io/reports/github.com/Setono/sylius-age-verification-plugin/master
28 changes: 13 additions & 15 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "setono/sylius-plugin-skeleton",
"description": "Acme example plugin for Sylius.",
"name": "setono/sylius-age-verification-plugin",
"description": "Setono example plugin for Sylius.",
"license": "MIT",
"type": "sylius-plugin",
"keywords": [
Expand All @@ -10,9 +10,9 @@
"require": {
"php": ">=8.1",
"sylius/core-bundle": "^1.0",
"symfony/config": "^5.4 || ^6.4 || ^7.0",
"symfony/dependency-injection": "^5.4 || ^6.4 || ^7.0",
"symfony/http-kernel": "^5.4 || ^6.4 || ^7.0"
"symfony/config": "^6.4 || ^7.0",
"symfony/dependency-injection": "^6.4 || ^7.0",
"symfony/http-kernel": "^6.4 || ^7.0"
},
"require-dev": {
"api-platform/core": "^2.7.16",
Expand All @@ -22,31 +22,29 @@
"infection/infection": "^0.27.11",
"jms/serializer-bundle": "^4.2",
"lexik/jwt-authentication-bundle": "^2.17",
"matthiasnoback/symfony-config-test": "^4.3 || ^5.1",
"matthiasnoback/symfony-dependency-injection-test": "^4.3 || ^5.1",
"phpunit/phpunit": "^9.6.20",
"psalm/plugin-phpunit": "^0.18.4",
"setono/code-quality-pack": "^2.8.1",
"shipmonk/composer-dependency-analyser": "^1.6",
"sylius/sylius": "~1.12.19",
"symfony/debug-bundle": "^5.4 || ^6.4 || ^7.0",
"symfony/dotenv": "^5.4 || ^6.4 || ^7.0",
"symfony/intl": "^5.4 || ^6.4 || ^7.0",
"symfony/property-info": "^5.4 || ^6.4 || ^7.0",
"symfony/serializer": "^5.4 || ^6.4 || ^7.0",
"symfony/web-profiler-bundle": "^5.4 || ^6.4 || ^7.0",
"symfony/debug-bundle": "^6.4 || ^7.0",
"symfony/dotenv": "^6.4 || ^7.0",
"symfony/intl": "^6.4 || ^7.0",
"symfony/property-info": "^6.4 || ^7.0",
"symfony/serializer": "^6.4 || ^7.0",
"symfony/web-profiler-bundle": "^6.4 || ^7.0",
"symfony/webpack-encore-bundle": "^1.17.2",
"willdurand/negotiation": "^3.1"
},
"prefer-stable": true,
"autoload": {
"psr-4": {
"Acme\\SyliusExamplePlugin\\": "src/"
"Setono\\SyliusAgeVerificationPlugin\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Acme\\SyliusExamplePlugin\\Tests\\": "tests/"
"Setono\\SyliusAgeVerificationPlugin\\Tests\\": "tests/"
},
"classmap": [
"tests/Application/Kernel.php"
Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</include>
</coverage>
<testsuites>
<testsuite name="AcmeSyliusExamplePlugin Test Suite">
<testsuite name="SetonoSyliusAgeVerificationPlugin Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
Expand Down
4 changes: 2 additions & 2 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Acme\SyliusExamplePlugin\DependencyInjection;
namespace Setono\SyliusAgeVerificationPlugin\DependencyInjection;

use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
Expand All @@ -12,7 +12,7 @@ final class Configuration implements ConfigurationInterface
{
public function getConfigTreeBuilder(): TreeBuilder
{
$treeBuilder = new TreeBuilder('acme_sylius_example');
$treeBuilder = new TreeBuilder('setono_sylius_age_verification');

/** @var ArrayNodeDefinition $rootNode */
$rootNode = $treeBuilder->getRootNode();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,21 @@

declare(strict_types=1);

namespace Acme\SyliusExamplePlugin\DependencyInjection;
namespace Setono\SyliusAgeVerificationPlugin\DependencyInjection;

use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\Extension;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;

final class AcmeSyliusExampleExtension extends Extension
final class SetonoSyliusAgeVerificationExtension extends Extension
{
public function load(array $configs, ContainerBuilder $container): void
{
/**
* @psalm-suppress PossiblyNullArgument
*
* @var array{option: scalar} $config
*/
/** @psalm-suppress PossiblyNullArgument */
$config = $this->processConfiguration($this->getConfiguration([], $container), $configs);
$loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));

$container->setParameter('acme_sylius_example.option', $config['option']);

$loader->load('services.xml');
}
}
8 changes: 4 additions & 4 deletions src/Resources/config/routes.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
acme_sylius_example_shop:
resource: "@AcmeSyliusExamplePlugin/Resources/config/routes/shop.yaml"
setono_sylius_age_verification_shop:
resource: "@SetonoSyliusAgeVerificationPlugin/Resources/config/routes/shop.yaml"
prefix: /{_locale}
requirements:
_locale: ^[A-Za-z]{2,4}(_([A-Za-z]{4}|[0-9]{3}))?(_([A-Za-z]{2}|[0-9]{3}))?$

acme_sylius_example_admin:
resource: "@AcmeSyliusExamplePlugin/Resources/config/routes/admin.yaml"
setono_sylius_age_verification_admin:
resource: "@SetonoSyliusAgeVerificationPlugin/Resources/config/routes/admin.yaml"
prefix: /admin
8 changes: 4 additions & 4 deletions src/Resources/config/routes_no_locale.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# localized URLs (see https://docs.sylius.com/en/latest/cookbook/shop/disabling-localised-urls.html).
# To accommodate this in your plugin, provide a routes file for non localized stores and tell this in the README.md

acme_sylius_example_shop:
resource: "@AcmeSyliusExamplePlugin/Resources/config/routes/shop.yaml"
setono_sylius_age_verification_shop:
resource: "@SetonoSyliusAgeVerificationPlugin/Resources/config/routes/shop.yaml"

acme_sylius_example_admin:
resource: "@AcmeSyliusExamplePlugin/Resources/config/routes/admin.yaml"
setono_sylius_age_verification_admin:
resource: "@SetonoSyliusAgeVerificationPlugin/Resources/config/routes/admin.yaml"
prefix: /admin
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

declare(strict_types=1);

namespace Acme\SyliusExamplePlugin;
namespace Setono\SyliusAgeVerificationPlugin;

use Sylius\Bundle\CoreBundle\Application\SyliusPluginTrait;
use Symfony\Component\HttpKernel\Bundle\Bundle;

final class AcmeSyliusExamplePlugin extends Bundle
final class SetonoSyliusAgeVerificationPlugin extends Bundle
{
use SyliusPluginTrait;
}
2 changes: 1 addition & 1 deletion tests/Application/.env
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ APP_SECRET=EDITME
# Format described at https://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
# For a sqlite database, use: "sqlite:///%kernel.project_dir%/var/data.db"
# Set "serverVersion" to your server version to avoid edge-case exceptions and extra database calls
DATABASE_URL=mysql://[email protected]/acme_sylius_example_%kernel.environment%?serverVersion=5.7
DATABASE_URL=mysql://[email protected]/setono_sylius_age_verification_%kernel.environment%?serverVersion=5.7
###< doctrine/doctrine-bundle ###

###> lexik/jwt-authentication-bundle ###
Expand Down
2 changes: 1 addition & 1 deletion tests/Application/.env.test
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
APP_SECRET='ch4mb3r0f5ecr3ts'

KERNEL_CLASS='Acme\SyliusExamplePlugin\Tests\Application\Kernel'
KERNEL_CLASS='Setono\SyliusAgeVerificationPlugin\Tests\Application\Kernel'
2 changes: 1 addition & 1 deletion tests/Application/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Acme\SyliusExamplePlugin\Tests\Application;
namespace Setono\SyliusAgeVerificationPlugin\Tests\Application;

use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Component\HttpKernel\Bundle\BundleInterface;
Expand Down
2 changes: 1 addition & 1 deletion tests/Application/bin/console
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env php
<?php

use Acme\SyliusExamplePlugin\Tests\Application\Kernel;
use Setono\SyliusAgeVerificationPlugin\Tests\Application\Kernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\ErrorHandler\Debug;
Expand Down
2 changes: 1 addition & 1 deletion tests/Application/config/bundles.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
Sylius\Bundle\ThemeBundle\SyliusThemeBundle::class => ['all' => true],
Sylius\Bundle\AdminBundle\SyliusAdminBundle::class => ['all' => true],
Sylius\Bundle\ShopBundle\SyliusShopBundle::class => ['all' => true],
Acme\SyliusExamplePlugin\AcmeSyliusExamplePlugin::class => ['all' => true],
Setono\SyliusAgeVerificationPlugin\SetonoSyliusAgeVerificationPlugin::class => ['all' => true],
Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true],
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true],
ApiPlatform\Core\Bridge\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true],
Expand Down
2 changes: 0 additions & 2 deletions tests/Application/config/packages/acme_sylius_example.yaml

This file was deleted.

Empty file.
2 changes: 0 additions & 2 deletions tests/Application/config/routes/acme_sylius_example.yaml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
setono_sylius_age_verification:
resource: "@SetonoSyliusAgeVerificationPlugin/Resources/config/routes.yaml"
2 changes: 1 addition & 1 deletion tests/Application/public/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

use Acme\SyliusExamplePlugin\Tests\Application\Kernel;
use Setono\SyliusAgeVerificationPlugin\Tests\Application\Kernel;
use Symfony\Component\ErrorHandler\Debug;
use Symfony\Component\HttpFoundation\Request;

Expand Down
38 changes: 0 additions & 38 deletions tests/DependencyInjection/AcmeSyliusExampleExtensionTest.php

This file was deleted.

Loading

0 comments on commit e095f13

Please sign in to comment.