Welcome to your IBM i update for October 2024.
This month, Andy focuses on an article originally published in IT Jungle on, ‘What’s New on PHP?‘ and includes an interview the originator, Alan Seiden to expand on the subject. We then broaden the conversation to the ‘whys and hows’ of developing in PHP on IBM i and introduce Pete Samways, who provides some real-life context on how it’s been done.
If you’re considering Python, PHP, Java or Node.JS for developing on IBM i, this should be a must read/watch post!
You can watch the video below or read the full article underneath.
Watch the Video:
PHP doesn’t get the publicity it deserves
So, in the July IBM i Update, I covered a presentation by Andy Youens at the iPower event in the UK on developing in Python on IBM i.
Python is one of the ‘big three’ native web languages on IBM i and it’s probably the most modern and clean language available and certainly gets all the buzz these days.
Nearly as ‘talked about’ is Node.JS, an efficient javascript runtime.
But of all the big three languages available it’s PHP, possible the most popular web language on the planet, that doesn’t receive the publicity it deserves.
This was picked up in an article by Alex Woodie at the end of October in which he covered an webinar by Alan Seiden, IBM i Champion, modern language expert and award winning speaker, on what’s new and exciting in PHP on IBM i in 2024.
In the webinar, Alan explains that, “People seem to have forgotten that PHP is just as robust a development language as RPG is on IBM i.” It’s solid, and you don’t get the foiboils and idiosyncrasies that you would when developing with Python and Node.js. And while it’s been a mainstay on IBM i for nearly 20 years now, it continues to evolve…
For example, Alan explained that PHP is mature and as such, enjoys toolkits that the other big two would be envious of. From connectivity, APIs, frameworks and resource, it’s all there for the IBM i developer where similar resources for Python and Node.js are well behind.
With this continual refinement in code and toolkits comes advantages with each new version becoming faster, moving from 32 to 64-bit and the ability to utilise more memory more efficiently – more than halving web page load times.
And, as PHP was developed as a web development language from the beginning, it’s a very practical tool for web developers and comes ready with everything you need to get started and build compelling applications without fear of unavailable packages or what module you want, the main extensions are built in so you’ll never have any compatibility issues.
Indeed, that’s why many vendors on the IBM i have used PHP to build their top tier tools, including the like of Fresche with their WebSmart tool and Curbstone too.
What’s new and exciting in PHP in 2024
But the crux of the presentation provided by Alan was in regards to what’s new and exciting in PHP in 2024…
In security, we enjoy JSON web tokens, built in support for cryptography, SSL/TSL and authentication methods.
With APIs, PHP now supports OpenAPI standards with Swagger and Postman integration, full REST & SOAP support with JSON now including validate. You can also call PHP from your RPG or CL code – always nice to have.
DB2 enjoyes undated extensions and PDO data object support.
Asynchronous programming has been a significant enhancement in PHP, allowing PHP scripts to handle multiple tasks at once. This can greatly improve performance when handling batch processing or making concurrent requests to IBM i resources without blocking the application.
And finally, it provides programming best practice… While you can still do things like undefined variables, it’ll warn you that this could probably create lag, so easy to use, forgiving while providing some back-up guidance too.
I’ve posted a link to the original webinar above, but for those who wish to dip their toe into PHP, where do you start, what should you expect and how does this all compare to the other big two languages anyway.
The power of PHP on the IBM i with Alan Seiden
Well, following Alan’s article, I took the opportunity to speak with him to discuss this and all things PHP…
[The below is a formatted summary of our conversation, for the full conversation, please watch the video]
Andy Nicholson: Alan, welcome to the IBM i Update!
Alan Seiden: Thanks, Andy. Great to be here, and thank you for everything you do for the community.
Andy: Alan, you’re well-known for your work with PHP on IBM i. With recent enhancements like new security features and ODBC connectivity, what do you think makes PHP such a solid choice for IBM i?
Alan: PHP has been here a long time and remains strong and community-driven. People often think of Node.js as the go-to for APIs, but PHP has supported JSON and other API-friendly features for years. It’s straightforward, performs reliably, and integrates well with IBM i.
Andy: I remember your presentation at Common Europe, where on the whole, I believe that PHP came out as a top choice for IBM i over other languages like Python and Node.js. What makes PHP stand out in your view?
Alan: PHP has everything you need built-in—there’s no need to build an environment from scratch. While other languages offer many module choices, with PHP, you have essential extensions in one package. This simplifies development on IBM i, allowing developers to focus more on solutions than on managing dependencies.
Andy: PHP is a widely-used language; how agile is it for IBM i development?
Alan: Very agile! PHP’s structure is straightforward, making it approachable for developers from RPG backgrounds. With frameworks like Laravel, Mezzio, and Slim, you have excellent options for organizing projects. PHP is flexible, too, allowing both procedural and object-oriented programming. I started with one line of PHP to send an email, and from there, it became a versatile language for various projects.
Andy: Can you share any specific success stories where PHP has enhanced IBM i systems significantly?
Alan: Absolutely! Curbstone Corporation, a PCI-validated payment solutions provider, processes over $8 billion annually on IBM i using PHP. Their systems run with a 99.9% uptime, handling both web and internal processes seamlessly. PHP has allowed them to build robust and scalable solutions.
Andy: How well does PHP integrate with traditional IBM i tools like RPG?
Alan: PHP works great with RPG, and the PHP Toolkit facilitates integration, letting RPG call PHP code and vice versa. This toolkit, which IBM, Zend, and I helped build, is highly mature and flexible. It can handle RPG program calls, data structures, and has reliable logging. This toolkit is one of PHP’s best assets on IBM i.
Andy: Many in our audience are experienced RPG developers. How easy is it for them to transition to PHP?
Alan: PHP is probably the easiest web language for RPG programmers to learn. Experience with SQL or HTML can speed up the transition, but PHP is accessible and can be learned independently. RPG developers often thrive with PHP due to its similarity in simplicity and focus on backend business functions.
Andy: For businesses considering modernization using PHP, what’s the best way to start?
Alan: Begin with a clear goal in mind. Look for opportunities that will yield big business benefits, like dashboards or integrations that can simplify data access. Start small, reuse business logic where possible, and focus on projects that will demonstrate value to executive teams.
Andy: And how is the PHP community for IBM i?
Alan: It’s strong and highly active. Our team has direct involvement in PHP’s core development, including database support and IBM i integration. With support from the community, PHP is well-established and continually evolving for IBM i.
Andy: In terms of security and performance, how does PHP on IBM i meet modern demands?
Alan: Performance improves with each PHP release, with recent updates yielding significant speed gains. For security, monthly updates address vulnerabilities promptly. IBM i users should stay current with these updates and have a testing plan. Keeping PHP versions updated is essential for performance and security.
Andy: Looking ahead, how do you see PHP evolving on IBM i?
Alan: We’re continually improving PHP for IBM i, especially in database connections and RPG integrations. The PHP community releases a new major update annually and minor updates monthly. Our focus on data handling and integration ensures IBM i compatibility keeps advancing.
Andy: Alan, thank you for your time and insight into the world of PHP.
Alan: No problem Andy, any time.
My thanks to Alan for taking the time to speak with me on developing in PHP on IBM i… his insight is invaluable as always and should you get the opportunity to see him speak – I heartily recommend it.
A real world example of developing in PHP on the IBM i with Pete Samways from StreamTech
Alan spoke much about developing in PHP and it’s advantages.
But, as they say, the proof is in the pudding. Therefore, to put this in context I thought a bit of real-life example would be in order.
As such, I spoke with Pete Samways, colleague and friend at Stream, an award winning transport and logistics system developed in PHP on IBM i, to provide some insight into how they developed this system, and some practical advice for those who are thinking of coding in PHP on IBM i.
[The below is a formatted summary of our conversation, for the full conversation, please watch the video]
Andy Nicholson: So Pete, welcome to the IBM i Update.
Pete Samways: Hello, Andy. Thanks for having me.
Andy: Could you start by telling us about your logistics management system?
Pete: Absolutely. As you mentioned, it’s a transport and logistics management system with a strong emphasis on customer service and tracking. We started developing it around seven or eight years ago. It’s browser-based, written primarily in PHP, though it also has substantial elements of RPG in the background. It uses the Db2 database on IBM i, and we currently have over 230 customers using the software.
Andy: Proximity began as an RPG shop, so what led to the decision to use PHP for this system?
Pete: Good question. Initially, we were looking to bring a modern look and feel to RPG applications for our existing customers, and at the time, PHP was probably the best language on IBM i for achieving this. Other options have emerged since, but personally, I’m still a strong advocate for PHP for various reasons we’ll likely discuss later.
One key factor was assessing how easy it would be to transition our existing RPG developers, most of whom are still with us, to PHP as their primary development language. Many IBM i-focused teams don’t naturally have those web-based skills, so PHP offered an effective path forward.
Andy: How did you integrate PHP with traditional IBM i features, such as Db2 and RPG, in your logistics application? Were there challenges in making these systems work seamlessly?
Pete: Yes, at the time, the main method of using PHP on IBM i was with the Zend Server, which was delivered as part of the IBM i ecosystem. To facilitate integration, we utilised the PHP Toolkit, an open-source tool that enables PHP to interact with traditional IBM i resources like RPG, CL programs, and files. This toolkit remains an essential tool for calling RPG programs within our Stream application.
Another critical component is the PHP extension database layer, which allows seamless interaction with the Db2 database. It provides functions within PHP for creating database connections, querying, and performing updates using SQL.
Andy: So would you say it was straightforward to work with IBM i?
Pete: Absolutely. It’s as straightforward as working with any database you’d typically use with PHP, like MySQL or MariaDB, with all the same functionality for connecting and querying.
Andy: Given the variety of tools available, are there any development tools or frameworks you’d particularly recommend?
Pete Samways: Definitely. If you’re writing PHP, a good integrated development environment (IDE) is essential. There are many out there, both free and paid, but we primarily use PHPStorm. It’s a paid tool but very capable, with features like code hinting, source control integration, and seamless deployment to IBM i.
For source control, we use GitHub, though any Git repository would work. In terms of frameworks, for structured development, Laravel and Laminas (formerly Zend Framework) are excellent choices. While Stream itself doesn’t utilise a specific framework for the web desktop element, our API layers use frameworks, which provide valuable structure and built-in functionalities.
Andy: It sounds like scalability and efficiency are essential in logistics. How does PHP handle large data volumes on IBM i?
Pete: Data handling is one of IBM i’s strengths. We’ve not encountered any speed issues with Db2, largely due to the close coupling between the database and processor on the same server. It’s different from cloud environments, where the database and processing might be on separate servers.
In terms of system resources, we’ve implemented resource partitioning to ensure specific areas get the resources they need. PHP isn’t a traditional IBM i workload, but we’ve set up specific memory pools for the web server to ensure efficient performance.
Andy: You’ve mentioned PHP’s adaptability for different customers. How have you managed to customise the application for varying client requirements?
Pete: That’s something we prioritise. Our approach to development is highly customer-driven, so we tailor features to meet specific customer needs.
Andy: Do you find PHP offers particular advantages for large, transactional applications on IBM i?
Pete: PHP is well-suited to heavy transactional workloads on IBM i, partly due to that close database-processor integration. Another advantage of PHP is its accessibility; it’s quick to learn, widely used, and has a wealth of online resources available. With around 40% of the internet using PHP, most problems you encounter have likely already been solved by someone in the community.
Andy: Logistics applications often handle sensitive data. How do PHP and IBM i support security and compliance?
Pete: Security is paramount. IBM i’s built-in security capabilities protect data at rest, while PHP and other web applications can encrypt data in transit. This combination allows us to implement a robust security framework within PHP.
Andy: How have customers responded to this solution? Are they aware it’s running on IBM i?
Pete: Feedback has been overwhelmingly positive, though most users wouldn’t know it’s on IBM i. For them, it’s just software they access via a browser or mobile app.
Andy: Based on your experience, what best practices would you recommend for developers building large-scale PHP applications on IBM i?
Pete: First, I’d recommend using a framework. It provides structure and pre-built functionality, which is invaluable, especially when starting with PHP. Laravel would be my current top choice due to its support and available resources. Source control is crucial, and I’d also suggest automated testing from day one, as PHP is well-suited for unit testing.
Andy: Are there any new features you’re considering for Stream?
Pete: We’re primarily driven by customer needs, but we’re exploring how we might introduce AI elements, particularly around route planning.
Andy: And finally, how do you see PHP evolving for use cases on IBM i?
Pete: PHP remains a strong contender for IBM i web applications. The key players like Zend and the Seiden Group continue to support it on the platform, so I expect it to stay relevant for a long time.
Andy: Thanks very much, Pete, for sharing your insights on PHP on IBM i.
Pete: You’re very welcome, Andy—it’s been a pleasure.
And my thanks to Pete for joining me too. As a company that’s developed a successful PHP solution on IBM i, I hope his insight will be of use.
That’s it for this months update.
Should you wish to view any of the articles featured in full, please check out our IBM i blog here.
Until next time,
Andy
Catch our previous August IBM i Update here. Alternatively, if you’d like to receive the latest IBM i Update hot off the press to your inbox, subscribe to the newsletter version on LinkedIn here.
Posted by Rob on 5th November 2024.