Services don't need names
I love Nette Framework's dependency injection solution. I really do. This post is here to share this passion, explaining why I think it is the best DI solution in today's PHP ecosystem.
I love Nette Framework's dependency injection solution. I really do. This post is here to share this passion, explaining why I think it is the best DI solution in today's PHP ecosystem.
In the course of the last few weeks, I have invested some time into Naja. You might recall my previous announcement in which I stated that there was still one big thing left to do. Well, now it is done!
Almost six months ago, I have released an alpha version of a new, modern AJAX library for Nette Framework named Naja. Now, after half a year in the wild production environment, I guess the time has come for a stable version.
I've had a really productive couple of weeks and (mostly) weekends recently. I've worked extensively on one of my side projects using modern JS stack including Webpack, faced issues here and there, and found a way to solve them. In the end, I proudly announce three new open-source packages: a modern AJAX library for Nette Framework, Neon loader for Webpack, and a library integrating the Webpack build process into Nette-powered applications.
Recently, in my bachelor's thesis, I've used extensively the whole Node.js and JavaScript ecosystem, including Webpack for bundling modules. And I love it. So there's no wonder I've tried setting it up in a classic Nette web application as well. Here goes a simple step-by-step example.
Testing your application against a real database and pseudo-real data is quite a challenge. I'm going to show you how to automate the process of creating a test database with its schema and filling it with data, all with tools you might already be familiar with, including Nette Tester and Doctrine 2 along with Doctrine Migrations and Data Fixtures.
Unit testing a class that uses Nette's cache can be a pain in the you-know-what. I've found myself writing a very simple cache factory to solve this and make testing classes depending on cache a pleasing experience, so I've decided to make an extension out of it.
Listing data is essentially the most crucial part of websites. Be it products, articles, photos or whatnots, we usually need to provide the user the way to filter and/or sort the data by some preset parameters. I'll show you how to encapsulate such filtering within an object, build a user interface (in other words, a form) upon it, and use it with Kdyby/Doctrine's query objects to actually filter the data on the database level.
Last December, I implemented smart forms via Kdyby/DoctrineForms on this blog. Since the documentation of the package seems to be quite lacking in its scope, I decided to share with you how to overcome the pitfalls I had encountered and make it work.
In order for components in Nette to be as reusable as possible, it is necessary to decouple them from presenters. The cleanest way out of this is to invert the dependency. After all, it's the presenter that requires the component, not vice versa.
The need for authentication mechanisms that provide more security has been rising during the recent years. Google has ventured into this field with their Authenticator application which is now used not only by Google itself, but also other big players like Github or Dropbox. And you know what? It's not really that difficult to join this elite group. I'm going to show you how.
Implementing a shiny new feature for one of our clients, we faced a challenging task. We needed to handle uploads of loads of files. Effectively. Without torturing the server with unnecessary stuff.
Earlier this week, I launched a brand new version of this website. It is written in PHP using Nette and Doctrine, uses Bower and Gulp to build assets, and strives to follow current best practices. And, last but definitely not least, its source code is open.
This text provides a comprehensive guide on how to configure Nginx and PHP-FPM and make it run smoothly with Nette framework.
Do components shared across multiple presenters bloat your BasePresenter? Well, PHP 5.4 comes with a solution to this, with these snippets of reusable code called traits.