In this article, you’ll find tips from an experienced Pimcore developer with more than 7 years in developing frontend and backend technologies and deep expertise with Pimcore. We’ll start with an introduction to Pimcore development and 5 things you should adhere to while developing apps.
Pimcore is an open-source custom experience management with all digital asset management. It allows you to connect multiple websites or platforms in one place where you can boost your business and be more productive.
There are 4 main advantages of using Pimcore:
- Understanding customers with a need for B2B & B2C platforms
- Easy searching, editing, and publishing items with Master Data Management
- Scalable CMS for any type of content and business
- Merging and consolidating data with Digital Asset Management
Every developer in the world has faced this challenge: You have a framework which is at the top of its game, and you choose a CMS made in that framework or for that framework. You install it (more or less) successfully, and you’re looking at the interface, and the PHP API. Scratching your head, you’re thinking: Where/How should I start?
It’s a natural part of learning, and in this article, we intend to help you better understand one particular system on one particular framework: Pimcore, based on the Symfony framework. Hopefully, you’ll be able to find your way around it after this read.
One more thing before we start: This article will NOT cover coding examples. The PHP API for Pimcore is well documented here. Instead, I’m going to outline some key concepts you’ll need to embrace to truly be successful in developing web applications on Pimcore.
Content management systems typically have a difficult time separating dynamic content from static pages, and indeed even media assets from content itself. This can present a problem when you’re working with a web application managing a lot of content with some media interspersed. Even such a thing as a daily-updated blog can sometimes be difficult to traverse if we’re talking about taxonomy, reusable images, content linked to other content, etc.
Pimcore has a clear separation of three different types of content you can create: Documents, Assets and Data Objects.
Documents represent your static pages. In this area, you cover the Landing pages, different content snippets, and basically everything you need to be permanently displayed on that URL. It also represents your sitemap for the site.
Every chunk of media you place on your site is located here. When you upload an image to an article, for example, it is stored in this area and linked to your article using Pimcore’s API. As reusability is a key factor, you can always access the images and media stored here and link them to other chunks of content you might have.
This is the dynamic custom content on your page. It has a structure based on folders, and you will put data which changes often in this area. For example, if your Pimcore installation is an e-commerce solution, the Products will be located here.
As you can see, when we say “Change your way of thinking”, we mean that the structure of this system is largely different from other solutions which can be found, making your content easily searchable and traversable. Creating a web application as a Pimcore developer will mostly consist of inputting data in one of these main areas, and you need to know where to put what.
Since it enables you to make a practically infinite number of different custom data types fast, Pimcore gives you an option to change the way your content creates the big picture. For example, say you have created a custom data type which has 5 selections. You later realize that you need to use that same selection in another data type. Pimcore allows you to reuse your existing selection options on several different content types.
But let’s take things even further. Now you realize that there are not only 5 choices in your selection. There are 50. And that number can get larger. Now it makes sense to create a custom datatype which will store your key and value into the database, and make your selection options available across multiple content types. Pimcore handles these scenarios very efficiently.
We’ve covered reuse, but what about chunk-izing? Well, chunk-izing simply means that you can (and certainly will) separate your content into smaller chunks which store groups of data connected logically. And which will always store the same data throughout the page. That way, you can create a view which has not one, but many small chunks of content all connecting logically, like Legos.
Let’s say you inherit a project that someone else already started working on. You try to test things out, but something deep inside the kernel throws an error. You need to debug, so you open the file that appeared to cause the error. To your surprise, nothing in the file seems to be causing the problem. What could it be?
When it comes to debugging, the hardest to find issues can be caused by event listeners, in particular triggers that somebody wrote and forgot about. So, when moving into an existing project be sure to deep dive into the code, and see the big picture. Try to get in the mindset of the person who wrote the code and what they were trying to achieve – that trigger is probably there for a reason.
Pimcore has lots of built-in features right out of the box, and because Pimcore is built on top of the Symfony framework, chances are that there’s already a bundle for almost any feature you need. At the very least you’ll probably find a PHP library to help develop such a feature.
When I started off with Pimcore, I needed to implement a QR Code feature for my application. The QR Code needed to be based on a URL, and it needed to be stored onto my system somehow. I was wracking my brain trying to find a proper QR Code library, then thinking of how to store it. Then a random search in the docs told me there was already a QR Code feature built-in! I could easily create an asset in Pimcore using the native PHP API to store the data, which made the whole thing easy.
Before you start custom coding something, don’t forget to arm yourself with the docs and Google, and try to find an existing solution. Be it a Symfony bundle, or a Pimcore feature, it probably exists somewhere. And only when you’re positive it doesn’t, try to create it on your own.
Pimcore is massive. It can seem overwhelming. And it’s ultimately a developer’s tool – you cannot just install it and get a ready-made web-page. You’ll need a bit of time and patience to learn it well.
Also, don’t be afraid to break your application. The best developers learn from their own mistakes. Don’t be afraid to ask questions. The larger community of Pimcore developers is forthcoming and willing to help. Be sure to create an account on Pimcore’s forum, https://talk.pimcore.org/. Your issues will be solved quickly.
Be sure to express issues and concerns you might have with this system. It makes for improvements, either in your own way of thinking or in the codebase of Pimcore itself. And finally, don’t hesitate to explore. Pimcore has a bunch of features, and you can use them all to solve problems you didn’t even know you had until you stumbled onto them.
And above all, don’t be afraid to become a Pimcore developer! It’s a gratifying experience, believe me.
article originally published at https://www.sourceseek.com/a-recipe-for-success-with-pimcore/