You are currently viewing FPDF/FPDI Libraries Integration with PSR-4 Standards
vteams- blog

FPDF/FPDI Libraries Integration with PSR-4 Standards

  • Post published:December 21, 2015

An event and ticketing management system (software) uses a desktop application built in C# language. Moreover, there are RESTful web services interface for tickets and events management built using Laravel 5.0. Using these web services, customers can:

  • Update their profile
  • Generate tickets
  • Reserve tickets
  • Cancel reservation
  • Get event details
  • Get invoices and all related operations
    .

Problem:

During web services usage, one of the services’ end point have to accept PDF file as binary input and split PDF into multiple PDF files per page and store those on Server. For this, vteams engineer Faisal Siddiq have to integrate FPDF/FPDI libraries as part of the ultimate solution.

The problem faced was that this libraries were not using PSR-4 standards for coding, testing, documentation and directory structure. He then had to do it in Laravel 5.0 that actually supports PSR-4 auto loading and namespace convention.

Solution:

For FPDF/FPDI libraries integration, Faisal converted both of them in PSR-4 standards manually. There were some bridge classes between both the libraries used for connecting both classes. After conversion to PSR-4 standards, classes that were inheriting the parent classes were not actually loading the default functions. To load that function, parent::callParentNeededmethod way was used.

After applying the above mentioned solution, vteam #164 was able to integrate both the libraries with desktop application and split PDF files.