Skip to content

Commit

Permalink
Merge pull request #1 from pdir/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
MDevster authored Jul 14, 2022
2 parents e27fcb3 + 847e266 commit 065b690
Show file tree
Hide file tree
Showing 14 changed files with 364 additions and 24 deletions.
21 changes: 18 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
# Changelog

[//]: <> (
Types of changes
Added for new features.
Changed for changes in existing functionality.
Deprecated for soon-to-be removed features.
Removed for now removed features.
Fixed for any bug fixes.
Security in case of vulnerabilities.
)

## [1.2.2](https://github.com/pdir/contao-webtools/tree/1.2.2) - 2022-07-11

- [Removed] ⚠ contao-backup-manager. With the new backup command introduced in Contao 4.13, this bundle will not be maintained anymore. Please refer to <https://docs.contao.org/manual/en/cli/db-backups>.
- [Added] use contao ^4.9 || ^5.0

## [1.2.1](https://github.com/pdir/contao-webtools/tree/1.2.1) – 2021-01-05

- [feature] Allow PHP 8
- [Changed] Allow PHP 8

## [1.2.0](https://github.com/pdir/contao-webtools/tree/1.2.0) – 2021-10-13

- [feature] use contao-backup-manager version 2
- [feature] set minimum required contao version to 4.9
- [Added] use contao-backup-manager version 2
- [Added] set minimum required contao version to 4.9
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
pdir webtools for contao web development

## Features in this bundle
- nothing yet
- provides a slightly modified version of the dump() function called pdump() which produces dump output only when the system is in dev mode: APP_ENV=dev. This should curb unwanted or forgotten dumps() somewhat.

## New functions through dependencies 🛠

- [🔗 Contao Backup Manager](https://github.com/richardhj/contao-backup-manager) Backup and restore database via contao console commands.
- [🔒 Sticky Backend Footer](https://github.com/pdir/contao-sticky-footer/) Placement of the action buttons at the bottom of the screen.

## Wishlist
- nothing yet
- coming soon
86 changes: 68 additions & 18 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,74 @@
{
"name": "pdir/contao-webtools",
"type": "metapackage",
"description": "Install pdir webtools dependencies via Contao Manager or Composer",
"keywords": [
"contao",
"pdir",
"tools",
"development"
],
"license": "LGPL-3.0-or-later",
"authors": [
"name": "pdir/contao-webtools",
"description": "Install pdir webtools dependencies via Contao Manager or Composer",
"license": "LGPL-3.0-or-later",
"type": "contao-bundle",
"authors": [
{
"name": "Contao Entwickler gesucht",
"name": "pdir GmbH",
"homepage": "https://pdir.de"
},
{
"name": "Mathias Arzberger",
"homepage": "https://pdir.de",
"role": "Developer"
}
],
"require": {
"php": ">=7.4",
"contao/core-bundle": "^4.9",
"richardhj/contao-backup-manager": "^2.0",
"pdir/contao-sticky-footer": "^1.0"
}
"homepage": "https://pdir.de",
"support": {
"issues": "https://github.com/pdir/contao-webtools/issues",
"source": "https://github.com/pdir/contao-webtools"
},
"require": {
"php": "^7.4 || ^8.0",
"contao/core-bundle": "^4.13 || 5.x-dev",
"symfony/config": "^5.4",
"symfony/dependency-injection": "^5.4",
"symfony/http-kernel": "^5.4",
"pdir/contao-sticky-footer": "^1.0"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.5",
"contao/manager-plugin": "^2.0",
"phpunit/phpunit": "^9.5",
"symfony/phpunit-bridge": "^6.1"
},
"conflict": {
"contao/manager-plugin": "<2.0 || >=3.0"
},
"autoload": {
"psr-4": {
"Pdir\\ContaoWebtools\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Pdir\\ContaoWebtools\\Tests\\": "tests/"
}
},
"config": {
"allow-plugins": {
"bamarni/composer-bin-plugin": true,
"contao-components/installer": true,
"contao/manager-plugin": true,
"dealerdirect/phpcodesniffer-composer-installer": true
}
},
"extra": {
"bamarni-bin": {
"bin-links": false,
"target-directory": "tools"
},
"contao-manager-plugin": "Pdir\\ContaoWebtools\\ContaoManager\\Plugin"
},
"scripts": {
"all": [
"@unit-tests",
"@ecs",
"@phpstan"
],
"ecs": "@php tools/ecs/vendor/bin/ecs check src tests --config ecs.php --fix --ansi",
"phpstan": "@php tools/phpstan/vendor/bin/phpstan analyze --ansi",
"unit-tests": "@php vendor/bin/phpunit --colors=always"
}
}
43 changes: 43 additions & 0 deletions ecs.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php

declare(strict_types=1);

use PhpCsFixer\Fixer\Comment\HeaderCommentFixer;
use Symplify\EasyCodingStandard\Config\ECSConfig;

return static function (ECSConfig $ecsConfig): void {

$date = date('Y');

$header = <<<EOF
Web-Tools Bundle for Contao Open Source CMS
Copyright (c) $date pdir / digital agentur // pdir GmbH
@package webtools-bundle
@link https://pdir.de/contao-webtools/
@license LGPL-3.0-or-later
@author Mathias Arzberger <[email protected]>
@author Christian Mette <[email protected]>
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
EOF;


$ecsConfig->sets([__DIR__.'/tools/ecs/vendor/contao/easy-coding-standard/config/contao.php']);

$ecsConfig->ruleWithConfiguration(HeaderCommentFixer::class, [
'header' => $header
]);

if (PHP_VERSION_ID < 80000) {
$ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\ControlStructure\TrailingCommaInMultilineFixer::class, ['elements' => ['arrays'], 'after_heredoc' => true]);
$ecsConfig->skip([\PhpCsFixer\Fixer\PhpUnit\PhpUnitExpectationFixer::class]); // see https://github.com/symplify/symplify/issues/3130
}

// Adjust the configuration according to your needs.
$parameters = $ecsConfig->parameters();

//$ecsConfig->set();
};
19 changes: 19 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
includes:
- tools/phpstan/vendor/phpstan/phpstan-phpunit/extension.neon
- tools/phpstan/vendor/phpstan/phpstan-phpunit/rules.neon
- tools/phpstan/vendor/phpstan/phpstan-symfony/extension.neon
- tools/phpstan/vendor/phpstan/phpstan-symfony/rules.neon

parameters:
level: 6

paths:
- %currentWorkingDirectory%/src
- %currentWorkingDirectory%/tests

universalObjectCratesClasses:
- Contao\Model
- Contao\Template

excludePaths:
- %currentWorkingDirectory%/src/Resources/*
19 changes: 19 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" colors="true">
<coverage>
<include>
<directory>./src</directory>
</include>
<exclude>
<directory>./src/Resources</directory>
</exclude>
</coverage>
<php>
<ini name="error_reporting" value="-1"/>
</php>
<testsuites>
<testsuite name="Pdir Web-Tools Bundle">
<directory>./tests</directory>
</testsuite>
</testsuites>
</phpunit>
37 changes: 37 additions & 0 deletions src/ContaoManager/Plugin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

declare(strict_types=1);

/*
* Web-Tools Bundle for Contao Open Source CMS
*
* Copyright (c) 2022 pdir / digital agentur // pdir GmbH
*
* @package webtools-bundle
* @link https://pdir.de/contao-webtools/
* @license LGPL-3.0-or-later
* @author Mathias Arzberger <[email protected]>
* @author Christian Mette <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Pdir\ContaoWebtools\ContaoManager;

use Contao\CoreBundle\ContaoCoreBundle;
use Contao\ManagerPlugin\Bundle\BundlePluginInterface;
use Contao\ManagerPlugin\Bundle\Config\BundleConfig;
use Contao\ManagerPlugin\Bundle\Parser\ParserInterface;
use Pdir\ContaoWebtools\PdirContaoWebtoolsBundle;

class Plugin implements BundlePluginInterface
{
public function getBundles(ParserInterface $parser): array
{
return [
BundleConfig::create(PdirContaoWebtoolsBundle::class)
->setLoadAfter([ContaoCoreBundle::class]),
];
}
}
35 changes: 35 additions & 0 deletions src/DependencyInjection/PdirContaoWebtoolsExtension.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

declare(strict_types=1);

/*
* Web-Tools Bundle for Contao Open Source CMS
*
* Copyright (c) 2022 pdir / digital agentur // pdir GmbH
*
* @package webtools-bundle
* @link https://pdir.de/contao-webtools/
* @license LGPL-3.0-or-later
* @author Mathias Arzberger <[email protected]>
* @author Christian Mette <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Pdir\ContaoWebtools\DependencyInjection;

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

class PdirContaoWebtoolsExtension extends Extension
{
public function load(array $configs, ContainerBuilder $container): void
{
$loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));

$loader->load('services.yml');
}
}
29 changes: 29 additions & 0 deletions src/PdirContaoWebtoolsBundle.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

declare(strict_types=1);

/*
* Web-Tools Bundle for Contao Open Source CMS
*
* Copyright (c) 2022 pdir / digital agentur // pdir GmbH
*
* @package webtools-bundle
* @link https://pdir.de/contao-webtools/
* @license LGPL-3.0-or-later
* @author Mathias Arzberger <[email protected]>
* @author Christian Mette <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Pdir\ContaoWebtools;

use Symfony\Component\HttpKernel\Bundle\Bundle;

// Load pdir global functions
require_once __DIR__.'/Resources/functions/pdump.php';

class PdirContaoWebtoolsBundle extends Bundle
{
}
4 changes: 4 additions & 0 deletions src/Resources/config/services.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
services:
_defaults:
autowire: true
autoconfigure: true
40 changes: 40 additions & 0 deletions src/Resources/functions/pdump.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

declare(strict_types=1);

/*
* Web-Tools Bundle for Contao Open Source CMS
*
* Copyright (c) 2022 pdir / digital agentur // pdir GmbH
*
* @package webtools-bundle
* @link https://pdir.de/contao-webtools/
* @license LGPL-3.0-or-later
* @author Mathias Arzberger <[email protected]>
* @author Christian Mette <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

use Contao\System;
use Symfony\Component\VarDumper\VarDumper;

if (!function_exists('pdump')) {
function pdump($var, ...$moreVars)
{
if (System::getContainer()->get('kernel')->isDebug()) {
VarDumper::dump($var);

foreach ($moreVars as $v) {
VarDumper::dump($v);
}

if (1 < func_num_args()) {
return func_get_args();
}

return $var;
}
}
}
Loading

0 comments on commit 065b690

Please sign in to comment.