This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Use yoda style for conditions. | |
Use strict modes for PHP type. | |
Compliant with PHPStan level 6. | |
Respect the SRP from SOLID principles. | |
Try to apply SOLID principles. | |
Use php attributes instead of YAML config in Symfony framework if possible. | |
With Symfony, don't use #[Template] attribute, use return $this->render() instead. | |
Use constructor property promotion. | |
Use typed properties. | |
Use readonly properties if possible. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$finder = PhpCsFixer\Finder::create() | |
->exclude('var') | |
->exclude('vendor') | |
->exclude('translations') | |
->in(__DIR__) | |
; | |
return (new PhpCsFixer\Config) | |
->setRiskyAllowed(true) | |
->setRules([ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Operation; | |
use ApiPlatform\Metadata\InflectorInterface; | |
use ApiPlatform\Metadata\Operation\PathSegmentNameGeneratorInterface; | |
use ApiPlatform\Metadata\Util\Inflector; | |
class LowerCamelCasePathSegmentNameGenerator implements PathSegmentNameGeneratorInterface | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# EditorConfig helps developers define and maintain consistent | |
# coding styles between different editors and IDEs | |
# editorconfig.org | |
root = true | |
[*] | |
indent_style = space | |
indent_size = 4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http; | |
use Symfony\Component\HttpFoundation\Response; | |
class TransparentPixelResponse extends Response | |
{ | |
/** | |
* Base 64 encoded contents for 1px transparent gif and png |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$httpClient = HttpClient::create(); | |
$request = $httpClient->request( | |
'GET', | |
'https://yourapi.com/endpoint' | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/packages/framework.yaml | |
framework: | |
http_client: | |
scoped_clients: | |
your_api: | |
scope: 'https://yourapi\.com' | |
headers: | |
Accept: 'application/json' | |
Content-Type: 'application/json' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$httpClient = HttpClient::create(); | |
$request = $httpClient->request( | |
'GET', | |
'https://yourapi.com/endpoint', | |
[ | |
'headers' => ['Accept' => 'application/json', 'Content-Type' => 'application/json'] | |
] | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
+----------------------------------------------------------------------+ | |
| APC | | |
+----------------------------------------------------------------------+ | |
| Copyright (c) 2006-2011 The PHP Group | | |
+----------------------------------------------------------------------+ | |
| This source file is subject to version 3.01 of the PHP license, | | |
| that is bundled with this package in the file LICENSE, and is | | |
| available through the world-wide-web at the following url: | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:16.04 | |
MAINTAINER Mathieu DUMOUTIER <mathieu@dumoutier.fr | |
LABEL version="1.0" | |
LABEL description="Apache 2 / PHP 7 / phpUnit / Composer" | |
RUN apt-get -y update && apt-get install -y \ | |
apache2 \ | |
curl \ |