Slide 1

Slide 1 text

Vanilla PHP how not to let the solution trees hide the wood of possibilities behind them https://www.flickr.com/photos/ted_major/6600956129/ Tomasz Kowalczyk

Slide 2

Slide 2 text

thunderer@THUNDER$ whoami PHP ~2007 Lead Engineer @ HASH.FM GitHub /thunderer Twitter @tmmx http://mientefuego.deviantart.com/art/Carbon-Glider-129268523

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

Brand new, shiny, greenfield project... $ composer create-project symfony/framework-standard-edition NAME $ composer create-project zendframework/skeleton-application NAME $ composer create-project yiisoft/yii2-app-basic NAME $ composer create-project cakephp/app NAME // ... $ composer create-project laravel/laravel NAME

Slide 5

Slide 5 text

Next steps? → scaffolding → bundles → controllers → modules → repositories → entities → views → templates → configuration → services → libraries → dependencies → tests → environment → forms → ...

Slide 6

Slide 6 text

how about some change?

Slide 7

Slide 7 text

NOPE*! “one bad programmer can easily create two new jobs a year” * irony

Slide 8

Slide 8 text

“ if it ain’t broke, don’t fix it ” - industry

Slide 9

Slide 9 text

FDD: FRAMEWORK-DRIVEN DESIGN → hinders ability to change → vendor lock-in → domain coupled to framework → locks away job opportunities → “Rails programmer”-like titles → artificial walls between people → forced structure https://www.flickr.com/photos/binaryape/3625043250

Slide 10

Slide 10 text

how can I change this?

Slide 11

Slide 11 text

components

Slide 12

Slide 12 text

look mOm, no framework! → Open Source projects “design pattern” → semantic versioning → modular, elastic and independent code → framework as an implementation detail → rewrite basic Symfony2 in less than 100 LOC → shorter and easier code means less bugs → use framework to build only “application” layer → code independent from changes in other projects

Slide 13

Slide 13 text

Example project structure: ............... ................ ................. ................. ................. ............... ................. ............. ................. ................. ................. ................. ................. ................. ............... ............. ................. ............... ................. .............. ........... ........ ..... /project /apps /web /etc /src /views /web /console /bin /cli /src /etc /lib /src /tests /uploads /var /cache /log /vendor .gitignore .travis.yml composer.json composer.lock phpunit.xml.dist project directory applications directory web application configuration web application source code web application views front controller console application application executable application executable source code console application source code project configuration domain code applications shared code unit tests user data (images, etc.) dynamic application data cache directory log directory dependencies dotfiles Composer files PHPUnit configuration

Slide 14

Slide 14 text

How to rewrite Symfony2: $twig = new \Twig_Environment(new \Twig_Loader_Filesystem(array($templatesDir)), array('cache' => $cacheDir)); $twig->addExtension(new TranslationExtension($this->getTranslator())); $twig->addExtension(new FormExtension(new TwigRenderer(new TwigRendererEngine(array('form_div_layout.html.twig'))))); $assetFactory = new AssetFactory($assetsDir); $assetFactory->setAssetManager(new AssetManager()); $twig->addExtension(new AsseticExtension($assetFactory)); $loader = new YamlFileLoader(new FileLocator(array($routingDir))); $router = new Router($loader, $routingFile, array(), null); $session = new Session(new NativeSessionStorage()); $formFactory = Forms::createFormFactoryBuilder()->addExtension(new CoreExtension()) ->addExtension(new HttpFoundationExtension()) ->addExtension(new ValidatorExtension(Validation::createValidator())) ->getFormFactory(); $transport = \Swift_SmtpTransport::newInstance($this->host, $this->port, $this->security) ->setUsername($this->user) ->setPassword($this->password); $mailer = \Swift_Mailer::newInstance($transport);

Slide 15

Slide 15 text

→ on your skills → on your experience → on your approach → on your requirements → on your company → on your process → (...) of course “it all depends” but maybe those are only minor excuses?

Slide 16

Slide 16 text

→ strong experience or experienced leader required → you need to care about structure and quality yourself → no ready-made solutions → manual implementation of all new ideas → you cannot rely on your knowledge of given framework → you cannot hire based on some framework knowledge of course there are disadvantages

Slide 17

Slide 17 text

COOL STORY

Slide 18

Slide 18 text

askQuestions() or die();

Slide 19

Slide 19 text

good code is not going to write itself... so... WE’RE HIRING! (YAY!) wait for it...

Slide 20

Slide 20 text

Thanks! (thanks for all your input!)