Skip to content

Instantly share code, notes, and snippets.

Avatar

Wojciech Sznapka wowo

View GitHub Profile
View sample-log.json
{
"time": "2020-09-13 15:45:00",
"level": "info",
"channel": "main",
"message": "Some log entry has been produced"
}
View service.php
<?php
namespace Example\FooBundle\Service;
use Doctrine\ORM\EntityRepository;
use Symfony\Component\HttpKernel\Log\LoggerInterface;
class FooService
{
protected $fooRepository;
View repo2.php
<?php
namespace Example\FooBundle\Repository;
use Doctrine\ORM\EntityRepository;
class FooRepository extends EntityRepository
{
}
View di2.xml
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="[..]">
<parameters>
<parameter key="example.foo.repository.class">
Example\FooBundle\Repository\FooRepository</parameter>
<parameter key="example.foo.service.class">
Example\FooBundle\Service\FooService</parameter>
</parameters>
View interface.php
<?php
namespace Example\FooBundle\Repository;
use Doctrine\Common\Persistence\ObjectRepository;
interface FooRepositoryInterface extends ObjectRepository
{
public function fetchLatest();
}
View class.php
<?php
namespace Example\FooBundle\Service;
use Doctrine\ORM\EntityRepository;
use Symfony\Component\HttpKernel\Log\LoggerInterface;
class FooService
{
protected $fooRepository;
View code.php
<?php
namespace Example\FooBundle\Repository;
use Doctrine\ORM\EntityRepository;
class FooRepository extends EntityRepository
implements FooRepositoryInterface
{
public function fetchLatest()
View di.xml
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="[..]">
<parameters>
<parameter key="example.foo.repository.class">
Example\FooBundle\Repository\FooRepository</parameter>
<parameter key="example.foo.service.class">
Example\FooBundle\Service\FooService</parameter>
</parameters>
View composer.json
{
"name": "wowo/log-demo",
"type": "project",
"require": {
"monolog/monolog": "^2.0"
},
"authors": [
{
"name": "Wojciech Sznapka",
"email": "wojciech@sznapka.pl"
View fastest-fx.php
$poundToEuro = (float) simplexml_load_file('https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml')->xpath("//*[@currency='GBP']")[0]['rate'];
You can’t perform that action at this time.