Skip to content

Commit

Permalink
feat(plugin): first version
Browse files Browse the repository at this point in the history
  • Loading branch information
delyriand committed Jul 2, 2024
1 parent 06da662 commit 759420a
Show file tree
Hide file tree
Showing 92 changed files with 3,760 additions and 35 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,13 @@ jobs:

recipe:

name: Flex recipe (PHP ${{ matrix.php }}, Sylius ${{ matrix.sylius }})

runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
php: ['8.2']
sylius: ["~1.13.0"]
php: ['8.1', '8.2']
sylius: ["~1.12.0", "~1.13.0"]

steps:
- name: Setup PHP
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/security.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@ jobs:

security:

name: Security check (PHP ${{ matrix.php }})

runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
php: ['8.2']
php: ['8.1', '8.2']

steps:
- uses: actions/checkout@v3
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,12 @@ jobs:

php:

name: Quality tests (PHP ${{ matrix.php }})

runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
php: ['8.2']
php: ['8.1', '8.2']

env:
COMPOSER_ARGS: --prefer-dist
Expand Down
61 changes: 58 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,67 @@
# Sylius Blog Plugin
<h1 align="center">Sylius Blog Plugin</h1>

This plugin adds a blog to your Sylius project. It allows you to create blog articles, tags and authors.

## Compatibility

## Compatibility

| Sylius Version | PHP Version |
|---|---|
| 1.12 | 8.1 - 8.2 |
| 1.13 | 8.1 - 8.2 |

## Installation

TBD
If you want to use our recipes, you can add recipes endpoints to your composer.json by running this command:

```bash
composer config --no-plugins --json extra.symfony.endpoint '["https://api.github.com/repos/monsieurbiz/symfony-recipes/contents/index.json?ref=flex/master","flex://defaults"]'
```

Install the plugin via composer:

```bash
composer require monsieurbiz/sylius-blog-plugin:dev-master
```

<!-- The section on the flex recipe will be displayed when the flex recipe will be available on contrib repo
<details><summary>For the installation without flex, follow these additional steps</summary>
-->

Change your `config/bundles.php` file to add this line for the plugin declaration:

```php
<?php

return [
//..
MonsieurBiz\SyliusBlogPlugin\MonsieurBizSyliusBlogPlugin::class => ['all' => true],
];
```

Add the plugin's routing by creating a new file in `config/routes/monsieurbiz_sylius_blog_plugin.yaml` with the following content:

```yaml
imports:
resource: '@MonsieurBizSyliusBlogPlugin/Resources/config/config.yaml'
```
Add the plugin's routing by creating a new file in `config/routes/monsieurbiz_sylius_blog_plugin.yaml` with the following content:

```yaml
monsieurbiz_blog_plugin:
resource: '@MonsieurBizSyliusBlogPlugin/Resources/config/routes.yaml'
```

And finally, update your database:

```bash
bin/console doctrine:migrations:migrate
```


## License

This plugin is under the MIT license.
Please see the [LICENSE](LICENSE) file for more information.
Please see the [LICENSE](LICENSE) file for more information._
6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
"description": "",
"license": "MIT",
"require": {
"php": "^8.2",
"sylius/sylius": "^1.12.0 || ^1.13.0"
"php": "^8.1",
"sylius/sylius": "^1.12.0 || ^1.13.0",
"monsieurbiz/sylius-rich-editor-plugin": "^2.8",
"monsieurbiz/sylius-media-manager-plugin": "^1.1"
},
"require-dev": {
"behat/behat": "^3.6.1",
Expand Down
2 changes: 2 additions & 0 deletions dist/.env.local
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SYLIUS_FIXTURES_HOSTNAME=${SYMFONY_DEFAULT_ROUTE_HOST:-localhost}
SYMFONY_IDE=phpstorm
2 changes: 1 addition & 1 deletion dist/config/routes/monsieurbiz_sylius_blog_plugin.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
imports:
monsieurbiz_blog_plugin:
resource: '@MonsieurBizSyliusBlogPlugin/Resources/config/routes.yaml'
3 changes: 1 addition & 2 deletions docker-compose.yaml.dist
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: '3.8'
services:
database:
image: mysql:8.0
Expand All @@ -18,4 +17,4 @@ services:
- 1080

volumes:
database: {}
database: {}
Empty file removed src/Controller/.gitignore
Empty file.
22 changes: 8 additions & 14 deletions src/DependencyInjection/MonsieurBizSyliusBlogExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,33 +18,22 @@
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;

/**
* @SuppressWarnings(PHPMD.LongClassName)
*/
final class MonsieurBizSyliusBlogExtension extends Extension implements PrependExtensionInterface
{
use PrependDoctrineMigrationsTrait;

/**
* @inheritdoc
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function load(array $config, ContainerBuilder $container): void
public function load(array $configs, ContainerBuilder $container): void
{
$loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$loader->load('services.yaml');
}

/**
* @inheritdoc
*/
public function getAlias(): string
{
return 'monsieurbiz_blog';
}

public function prepend(ContainerBuilder $container): void
{
$this->prependDoctrineMigrations($container);
return str_replace('monsieur_biz', 'monsieurbiz', parent::getAlias());
}

protected function getMigrationsNamespace(): string
Expand All @@ -63,4 +52,9 @@ protected function getNamespacesOfMigrationsExecutedBefore(): array
'Sylius\Bundle\CoreBundle\Migrations',
];
}

public function prepend(ContainerBuilder $container): void
{
$this->prependDoctrineMigrations($container);
}
}
Empty file removed src/Entity/.gitignore
Empty file.
Loading

0 comments on commit 759420a

Please sign in to comment.