Symfony 4 – jak stworzyć nowy projekt

Symfony to obecnie jeden z najbardziej rozwiniętych frameworków w świecie PHP. Może wydawać się z początku skomplikowany w użyciu, jednak to tylko pozory. W rzeczywistości aplikację internetowe z zużyciem Symfony pisze się bardzo łatwo. Nie musimy się martwić o wiele podstawowych elementów, skupiamy się na tym co jest istotne – na funkcjonalności naszej strony internetowej. Jak zainstalować […]

Instalacja Composera

Composer to narzędzie do zarządzania zależnościami w projekcie. Możesz dzięki niemu w łatwy sposób dołączać biblioteki lub uaktualniać je. Instalacja w linii komend Skopiuj i uruchom w linii komend następujący kod. Instalacja w Windowsie przez instalator Możesz ściągnąć instalator bezpośrednio ze strony Composera. Po uruchomieniu instalator zainstaluje Composer i uaktualni PATH sprawiając, że Composer będzie […]

Vagrant, Chef, PHP and XDebug

How to install XDebug with Vagrant and Chef Install Chef Development Kit Create new cookbook ➜ dev berks cookbook xdebug-box create xdebug-box/files/default create xdebug-box/templates/default create xdebug-box/attributes create xdebug-box/libraries create xdebug-box/providers create xdebug-box/recipes create xdebug-box/resources create xdebug-box/recipes/default.rb create xdebug-box/metadata.rb create xdebug-box/LICENSE create xdebug-box/README.md create xdebug-box/CHANGELOG.md create xdebug-box/Berksfile create xdebug-box/Thorfile create xdebug-box/chefignore create xdebug-box/.gitignore create xdebug-box/Gemfile create […]

Summarizing Backend vs Frontend Page Performance using Scalding

Some time ago I started collecting the page performance data using boomerang.js. As a data storage I simply used access logs. The result is quite predictible. Most of the load time is spent on frontend (except page 10.html, where are some computation). Firstly I wrote a Cascading job. Later I rewrote it for Scalding. As […]

Choose the right tools for your Magento project

Magento can be hard. We all know it. We can make your work easier by picking the right tools. I wanted to share with you the stuff I am using in my last project. And which, IMO, should the MUST-BE in every Magento installation. PHP-Error https://github.com/panrafal/PHP-Error Better error display. My hack for it https://gist.github.com/piotrbelina/10d5544c5fc872ec2a77 Aoe […]

Using PHPUnit with Gaufrette to unit test IO-dependent behaviour

Recently I wanted to test some class which uses heavily IO. I was refactoring some legacy code depending on file_get_contents and other file functions. To allow easy testing I added Gaufrette library and replaced all native PHP functions operating on IO. <?php use Gaufrette\Filesystem; class Generator {     /**      * @var Filesystem […]

Magento: Enabling modules via local.xml

I wanted to enable some modules only locally, without the possibility to use them on production. This would eliminate a vulnerability of leaking debug data. As an example I will use Magneto Debug module. To enable a module only locally and keep it turned off anywhere else. In app/etc/modules/Magento_Debug.xml delete the line <active>true</active> In app/etc/local.xml […]

Magento: Debugging Webservices

During an audit I had to check with a debugger how one of Magento Webservices works. I found a post on Troubleshooting Magento Web Service using Python so I could easily manipulate with SOAP requests. To debug the code in IDE I added the cookie with XDebug session id. from suds.client import Client from suds.xsd.doctor […]

Symfony 2: Sending a file to download from controller

Here is a snippet how to send a file to download. It creates a zip archive and sends it. <?php namespace Acme\DemoBundle\Controller; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\ResponseHeaderBag; use ZipArchive; class MyController extends Controller     /**      * @Route("/", name="index")      */     public function indexAction()     { […]

Magento, Composer and Dependency Injection

Recently I found an information about Composer installer for Magento. I explored this a little bit and I managed to include some other packages (Monolog) and Symfony’s bundles into magento installation. To allow easy configuration I included also Symfony’s Dependency Injector. How to use it? Define composer.json in root dir {     "minimum-stability": "dev",     […]