N8N and PHP With Edward Barnard

N8N and PHP With Edward Barnard

Oct 29, 2025

In this episode, Scott talks with Edward Barnard about his column in PHP Architect magazine and his current series on using N8N with PHP to create reusable workflows. Links: N8N - https://n8n.io/ Beyond Prompt Engineering - https://leanpub.com/beyond-prompt-engineering Lean Startup Book - https://www.amazon.com/Lean-Startup-Entrepreneurs-Continuous-Innovation-ebook/dp/B004J4XGN6/ displace.tech - https://displace.tech/ Our Discord - https://discord.gg/aMTxunVx Buy our shirts - https://store.phparch.com/products/community-corner-podcast-t-shirt Scott's Social Media: Website - https://scott.keck-warren.com/ Bluesky - https://bsky.app/profile/scottkeckwarren.bsky.social LinkedIn - https://www.linkedin.com/in/scott-keck-warren-91689810/ Mastodon - https://phpc.social/@scottkeckwarren

Transcript

Scott Keck-Warren Scott Keck-Warren 0:05
Hello developers, and welcome to the PHP Architect Community Corner. We have conversations with members of the web development community. I'm your host, Scott Keck, and today we're talking with Ed Bernard about, uh, all of his different things that he works on, including his article in PHP Architect magazine and his recently released book on AI. Edward W. Bernard brings unique implementation experience from programming Cray supercomputers at the hardware level. Debugging systems at classified facilities, and solving critical Y2K infrastructure problems. His 20+ years at Cray Research includes hands-on work with assembly language, operating systems, and I/O subsystems. His cross-domain experience from NSA troubleshooting to Saudi America— AmeriCo installations provides practical insights into applying advanced problem-solving techniques across diverse technical environments. After a second 20-year career focused on PHP applications, Edward has began developing a new area of artificial intelligence collaboration based on supercomputing skills developed during the Cold War era. He has written more than 100 articles for PHP Architect magazine. PHP remains his language of choice. Thank you, Ed, for finding some time to talk to us today.
B
Speaker B 1:13
That was Saudi Aramco in the country of Saudi Arabia. Aramco standing for Arabian American Oil Company. And that's the nature of the US-Saudi relationship, has a whole lot to do with the oil history. So yes, that's it.
Scott Keck-Warren Scott Keck-Warren 1:32
Okay, awesome. So I've come across you several times over the years. You were at, I think, Midwest PHP. You did a whole tutorial track about teaching people how to do PHP, which I like missed for, 'cause that wasn't my, my, my like interest level. But then you're also one of the columnists in PHP Architect Magazine, which you've, I didn't know you've written over 100 articles, which is impressive. Can you, can you talk to us a little bit about what it is that your column generally constitutes? It's the, the back office column?
B
Speaker B 2:05
Yes. I tend to write odd material. And that's coming from, I guess the best way to describe it is trying to show more of a big picture view. Here are other things that a breadth of experience can bring to you. And very often it's, well, this is the problem we had last week and this is how we solved it, problem plus solution in PHP, and then report the following month that that didn't go well. But that's PHP, that's normal website development, especially with legacy systems. So the back office is focused on backend considerations as opposed to frontend and user interface considerations. Originally, the idea was to, which I did, more in the way of data warehousing concepts. Because with PHP sites, we normally don't do data warehousing, not in the normal enterprise sense. So that's a lot where it came from. And let's see. No, I put them away. My mascot was a carrier pigeon, because I figured, well, back office, use carrier pigeons as your transport layer. There is an RFC for that, by the way, as some people will know. So within the back office column then, what I'm currently doing, and it might end up being actually a 6-month series, today I'm writing part 4. The last magazine had part 3, and dealing with workflows, and specifically using an N8N as a workflow engine. Should I just keep talking about that? Is that okay? Mm-hmm. Okay. So N8N seems to be rapidly becoming more and more adopted in our industry, and not just PHP. I'm using it from a personal project standpoint. And so N8N allows a community edition where I install it on my own laptop. I register with them. I just give my email address. and then I have an unlimited license for unlimited anything as a local installation. So it's very good for personal projects in that way and also learn some things. n8n is integrated with Node, which means JavaScript. And I've often said that computer software and websites run really, really fast unless they're JavaScript. And I usually make sure I'm at arm's length when I say that to keep myself safe. But what I found was if you are looping through a series of records, that was my workflow, was I was going through a whole dataset and extracting information. Well, if you are doing a loop, that means a new invocation of the node each time, and there's a very slow startup cost for that node. So it turned out that, and so doing it as a single MySQL query, which is what I showed in the column, versus doing it as a loop, went from 3.5 hours to 2.5 seconds. And so part of what I talk about is the idea of, look at these from a bigger picture standpoint, from an architecture standpoint. In this case, what is the constraint? In this case, it was my lack of patience. And so can I think about this differently? And it turned out that training it as a data warehousing process was the right answer. These are problems that have long since been solved by other people. And I like to read a lot of, they're back there. Yeah, there we go. I read a lot of outside books. So I would much rather take the time to read how somebody else did it than take the weekend to figure out the hard way that I don't know how to do it. Right. So yeah, let me talk about workflows in general briefly.
Scott Keck-Warren Scott Keck-Warren 6:50
Um, yeah. And before
B
Speaker B 6:51
we all, we all have, go ahead, go ahead.
Scott Keck-Warren Scott Keck-Warren 6:53
Before we kind of, so like, and, and I, I wanna make sure that like, I'm, I'm like, for people who don't know what like NaNN is, so like, and it's, so the idea is like you have like a, you design a workflow and like it has multiple kind of like steps involved in it. So if you haven't read like the articles, I highly recommend finding, finding Ed's articles and kind of going through them. And so like there's, there's kind of like little, I don't know, discrete chunks basically where like each chunk has like an input and an output. And they just kind of like work their way through the system. And so, and I know that like, it's become like, it's become like a big deal. Like I feel like in the last 5 months, maybe like it's, I've heard more and more about it, but like realistically, like I've seen a lot of stuff where it's like, this is a no-code solution for people. And I think Ed's approach is the approach that you've, you've kind of taken to it is like, well, you can use it and then also implement your own little chunks in there to like, because we know PHP, we know MySQL. Yeah. And so you can kind of have those pieces. And I think that's really the thing that fascinated me about the articles is like, oh yeah, we can extend this because we're programmers and we have more functionalities essentially. So is that a good encapsulation of that or?
B
Speaker B 7:59
Yes. And another analogy is something my son, he's now Dr. Jacob Barnard, professor of computer science over in North Dakota, noted is I was doing things where I was using like 5 different tools to do my work, a workflow related to, well, actually related to writing a book. And this was during his PhD dissertation, and he kept trying to find the one perfect tool that did everything. And Eric Ries, who is the author of The Lean Startup, I had it handy. I highly recommend it, by the way, for anyone doing PHP development. It's got some very good ideas in it. Eric Ries, The Lean Startup. So it's about 10 or 12 years old. One thing he mentioned is, yes, when you are doing a prototype, if you are trying to put all the features in and do everything for everybody, What you've got is QuickBooks that nobody can use because it's just got, it's got, he actually was talking about QuickBooks. And so what I really like about N8N is I can take this tool for this, that tool for that, that tool for that. And then I can, this is actually one of my workflow sets of workflow notes. And so I've got myself little notes and then each of those would become a step in the N8N workflow. And so the ability to orchestrate a bunch of steps, some of which could be manual, but do it in a way I know best. It will do direct SQL queries so that for my data import ETL process, part of it was MySQL and then the actual extraction I did in PHP. Well, it doesn't have a direct a way to directly call PHP, but it does have a way. I'm running on a MacBook Pro, which is Unix, similar to Linux, of course. And so Laravel, for example, has very good support for creating a command line. It's, you know, php artisan, whatever, as do the other frameworks, because we can run PHP scripts at the command line. PHP-CLI is the correct interface. And so I just create something in PHP as a PHP script, or in this case, doing it, I'm doing it inside Laravel. That way I've got access to Laravel models and the entire infrastructure. And then from NaN, I simply call the command. Real simple. And so the idea of building a workflow that is using the best tool for the job in each case, And it does natively support hand-coded JavaScript. Hand-coded JavaScript and I don't get along very well in N8N. And the reason is in N8N, you have one step, then the next step, then the next step. And so there's a data flow between each step and how that is structured is not at all obvious, and it's very hard to identify. So what I did was on N8N, I take the results, put them into a MySQL table. I know how to deal with MySQL tables, and so do you. And I can look at the result. And then the next one reads that table and uses the next table as the output. And so I don't care about the communication. I only care about the control, step 1, step 2, step 3, and then I can— and so that works. So as a way of orchestrating, it works very well. And in fact, in my view, that's kind of its purpose is orchestrate somebody else's stuff. Pardon me a moment.
Scott Keck-Warren Scott Keck-Warren 12:15
No problem.
B
Speaker B 12:16
Okay. Excuse me. So N8n has a very good UI. And so you can look at the steps, and I have screenshots in magazine articles, and what you have is the top-level flow. It is literally the sticky notes that you'd put on a whiteboard if you were designing something, and it's just right there, and it will do it for you. And so that's very nice. And then you can look into each one. So yes, I'm finding it to be a very useful tool. But I need to point out the idea of losing the forest for the trees versus losing the trees for the forest. With workflows, you need to be aware of both aspects. What is it that I'm trying to accomplish? And that's where I step back. Well, the loop wasn't working, but what I'm trying to accomplish actually looks a whole lot like a data warehousing ETL, extract, transform, load business process. Why don't I do it the way it was if it was a business process? And it went 100 times faster. Who knew? So that's the big picture part. And then once I understand the big picture, then the individual trees, they all fit. And I literally lay things out by hand. Oh, never mind the phone number. Lay things out by hand. And that works. And so my workflow is part N8N, is part sticky notes, is part database. And another, yes, and a very, another thing we always worry about with, in the PHP world, meaning website, is, okay, I've got, I'm using this new tool. Is the company that produced that new tool going to be around a while? And so the fact that it appears that N8N adoption is going up rather rapidly, and so there's a growing community, and meanwhile I'm on their mailing list, and so I get N8N announcement mailings now and then. Those are all good signs that it's still gonna be around next year.
Scott Keck-Warren Scott Keck-Warren 14:30
And we'll be back after this word from our partners. Building PHP applications is your passion. Managing cloud infrastructure shouldn't be your headache. Displace is your partner in cloud infrastructure orchestration, giving solo developers and small teams the tools and automation to deploy enterprise-grade Kubernetes clusters without enterprise-grade complexity or cost. Their CLI tool streamlines everything from local development to fully managed cloud deployments on AWS, Azure, GCP, and more. Skip the steep learning curve of Docker, Kubernetes, and Terraform. Let our automation free you to focus on your core business without losing control over your infrastructure. Get started at displace.tech and discover how the right tools can eliminate the need for a full DevOps team. We use a, um, we use something, a similar, similar product at work. Um, it's not N8N. And I think like realistically, like the, it wasn't my, it wasn't my pick. Somebody else picked it like a long time ago. Um, but like they have, they have the problem of like, it's a for-profit company and like, we don't know if like that company is going to disappear, but like this does have a community edition where theoretically, like, because it seems like that, that is a functional thing for us. If we could just say, but we wanna use this thing that's free and open source, and now we can just kind of run it, which is a huge benefit to all of those pieces, I think.
B
Speaker B 15:49
Good examples are RabbitMQ is run by a company, but there's a free version, Elasticsearch. And so I take that as a good sign, meaning that the profit company's gonna be around. Laravel itself has now become a for-profit company, but we've got all sorts of promises that We'll still have our own versions. But that also brings up a good point, and that's, again, keep in mind that that is always a consideration. The more you can make yourself not locked into something, the better.
Scott Keck-Warren Scott Keck-Warren 16:29
Yeah, and I think the way it kind of gets used is like it's its own segment and then it dumps data into another product. And so I think the thing I've been really fascinated by is like, Because we have like some custom stuff. I don't remember what the language is, but there's like custom pieces in there sometimes to do the transforms that we need, needed to do. And like, I like the, like your approach of saying, well, here's like the different steps. And then all of those, like the, those like more complicated bits can exist within my PHP code. Because I'm guessing like, there's probably like a lot of times where like, you don't, like, we have to touch the, the workflow a little bit sometimes and like when we find bugs or whatnot, but like all the bugs could exist within, like, like if it's just doing the, like the steps essentially, and all the, all the actual logic is being handled by PHP and MySQL, then we can like put all that in our source code repository and like have it tested and, you know, version and everything, which I think is really like a much better approach to all this. Um, so yeah.
B
Speaker B 17:29
And there's a, there's a principle there that you're coming very, very close to, which is an ETL principle, and that is Make the step as small as possible with one single responsibility, and that you can clearly see, for debugging purposes, what is the input to that step, and then what is the output from that step, and don't do a whole lot of processing. It's far better to do 20 little tiny steps than it is one big step that does 20 things. for debugging reliability and the chances of getting it right the first time. With n8n, there's such a thing as workflows. We call them subroutines or functions in PHP. And so I can have a main runner, which the main runner would run this sticky note, and then it would run this sticky note. Well, I'm in the middle of development. There's actually a 3rd sticky note out here, And so, as I develop that 3rd sticky note of work of 10 steps, then I just add it, I just call it. And so, the idea of just adding methods and classes, same, very similar idea. So, you know, these are universal architecture type things. And I've also found that working with AI, AI is strongly inclined to do absolutely as much as possible in a single step. which is the opposite of what's useful because the idea is just click the button and then everything happens. But yeah, that's usually like spilling a carton of milk. It's, yeah, everything happened.
Scott Keck-Warren Scott Keck-Warren 19:16
Yeah. And I feel like the, especially with coding and large language models, it's a lot of reiteration of like what we're trying to do, right? Like it's, it's, you know, like, and that's, that's the, I always have a hard time with like large language models and workflow automation because there's always like, it never is just like, here's the output and it's in good shape, right? There's always like some follow-up step. So I'm, I'm kind of, I don't know. Yeah. I'm, so I'm curious that, I don't think I, I think I missed that part. I know that like you're planning on piping your, so like the, the workflow that you're building takes a bunch of documents and then like pipes them through. I'm sorry, I'm blanking. And through a large language model, is that kind of like the gist of what you're doing with the article?
B
Speaker B 20:01
You're actually correct. My problem is that I have been saving transcripts of conversations. I have more than 5 million words referring to English language words, English language text of transcripts. And In other words, for one person, that's a lot. Also for passing it through a large language model, that's a lot. And so I was collecting things in batches to look for things and ultimately trying to reprocess all of that didn't prove necessary, didn't make sense, and was just too much for that use case. On the other hand, as I'm thinking back, well, I want to go back to a certain area or conversation by— I've got those transcripts spread across about 2 dozen different directories. And so finding what I wanted, well, this workflow allowed me to actually gather everything into suitable chunks that are organized by calendar date, And by each time I had a new conversation, I started a new folder. So organized in that sense. And so I've given myself a usable repository. And then what I do is I put that repository inside PhpStorm. PhpStorm has a very good text search. Since the transcript is of my talking, Either Claude or I did the typing. I have a good enough memory that I can kind of remember what it was I was talking about. And so that gets everything into one place where I have my own search engine, which is PhpStorm, which is really lame when I'm using AI to form it in the first place. But at the same time, processing 6 million words of transcripts, Takes, it's under a minute, and that's just on a laptop. Doing it as a loop, just using proper data warehousing ETL processes, it's under a minute to get everything gathered in, and that's with the PHP extraction steps and everything. Did I sort of answer your question? Yes. So, A key limitation, there's large language models. I should back up, be clear. I have decided to focus on a single large language model and gain a depth of experience with one as opposed to a breadth of experience with lots of them. So I'm speaking specifically of Claude 3.7, Anthropic. Claude 3.7, which is the one with all of the copyright lawsuits going on because they like to steal authors'. Well, we won't go into that. That's for the lawyers. I agree with the lawyers' side, not Claude's side on that. But 2 key limitations are the large language model is based on input. Input is the training data. And so in this case, the training data cutoff, I believe, was at or near the end of 2024. And therefore Claude has no knowledge of anything that happened after that point. And in fact, if I refer to a date that was yesterday, Claude says, oh, this is sometime in the future. Are you sure you meant that? And so I've learned to add, okay, and today's date is... September 30th. So that's one of the key limitations. The other key limitation is the input window. And if you're going, depending on what application you use, there's ways of adding files as kind of as GPT calls it a project and you can add files. And so you basically have your own knowledge base. The way I'm using it, it's just current immediate input, which means you're limited to— everything gets tokenized and then you're limited to how many tokens can fit in that window. Well, if you're holding a conversation for a week or more, and so the conversation transcript runs to 500 PDF pages, if you were silly enough to do that, you're well beyond the context window. And so I've just, I didn't realize that was a problem for everyone. I just did, took, I just automatically used the same techniques I used 40 years ago when I was working with supercomputers with very, very small spaces to work with. And same techniques work. Who knew? And that's why I put the Cray research material in my introductory bio. is I'm, I'm all of a sudden that experience is becoming more relevant than my PHP experience. Who knew?
Scott Keck-Warren Scott Keck-Warren 25:26
Yeah. I, I, I find that as like an interesting piece of like your, your articles is like, you do have like all those weird, I don't know, weird is not the right word. You all, you have all this, like this history with like computer computers and like, I, I've never worked with like a Cray computer. I've never worked with like, I've, I have, I have a computer engineering degree, so I did some like hardware debugging at university, but never anything as in-depth as like that.
B
Speaker B 25:50
That is a circuit board from the last Cray-1 ever made.
Scott Keck-Warren Scott Keck-Warren 25:54
Oh, okay. That's cool.
B
Speaker B 25:55
That's a supercomputer. So that is a Cray-1 supercomputer board. Um, and you also, and you know, it is not large-scale integration. Those are individual chips. Each of those chips is a, uh, 1, 2, or 4 gates. That's it. And there was reasons for that. But yeah, that's literally ancient history, previous millennium.
Scott Keck-Warren Scott Keck-Warren 26:22
Yes. Yeah. Yeah. I think that thing said '84 on it, right? Is that what the—
B
Speaker B 26:28
Yes. That was actually the Saudi Aramco Cray-1 installed in 1984. I and family went out as part of the site support, and it was decommissioned in 1990.
Scott Keck-Warren Scott Keck-Warren 26:42
Okay. So that's a pretty good longtime run for a computer, I guess, for 19 years. Yeah.
B
Speaker B 26:50
Yes. And they used it for oil exploration. The primary application for that one was what they call reservoir simulation. And Ford did engine simulation and so on, but they would take everything they know about a given oil field and then they would consider, well, if we take this empty well and pump high-pressure seawater down it, could we recover more oil over here? And they'd run the simulation with all sorts of different datasets and possibilities. And of course they're dealing with the largest oil fields in the world at that point. While I was there, up to a certain point, every single year they discovered more oil than they pulled out of the ground that year. Their reserves went up every single year until a certain year. Care to guess what happened that year? And this would've been around—
Scott Keck-Warren Scott Keck-Warren 27:51
The first Desert Storm?
B
Speaker B 27:54
No, it was before Desert Storm. I think it was 1986, Actually, if I'm remembering correctly. So Desert Storm, Desert Shield happened in fall of 1990, and then Desert Storm was late January of 1991. No, why they stopped, why the amount of known reserves didn't exceed the amount, they stopped looking that year.
Scott Keck-Warren Scott Keck-Warren 28:23
Oh.
B
Speaker B 28:24
They simply stopped looking. And that's the only reason it stopped going up.
Scott Keck-Warren Scott Keck-Warren 28:29
Right. Well, that's a good reason to stop. Yeah. So I really, unfortunately, I have to call it, like bring this to a close. It's really nice, like chatting with you about all these things. And I do recommend like everyone check out your articles in the magazine. They're always like informative and interesting. There's always like some, even if it's not technology related, like I know you like, you were talking about Hedy Lamarr for a while. and some of her stuff. But is there anything that you wanna direct our listeners to before I let you go for today?
B
Speaker B 28:58
This is where I get to tell you about my book on AI, which I'm developing as a PHP person. And so in the magazine, the current article, the magazine that just came out, at the end of my article, the next page is the link to my book. about going beyond standard prompt engineering.
Scott Keck-Warren Scott Keck-Warren 29:21
Okay. And that should be the September issue. And I will put a link in the episode description so people can find the book. And I'm going to go take a look at it. It's unfortunate. Like, I have a subscription to the magazine, so I have those things, but I don't always get all the pieces because I read like the preprints because I want to know what's going on in the magazine before people are actually published. So I missed some of, I missed the, those things. So, but I really do appreciate you finding some time to talk to us today.
B
Speaker B 29:50
Thank you, Scott.
Scott Keck-Warren Scott Keck-Warren 29:52
Yeah, absolutely. I have to say another heartfelt thank you to Ed for all of his time, as well as you for listening. If you're not already a subscriber, make sure you subscribe with whatever your preferred method is. We have both an audio version on the PHP Architect website, as well as a video version on our YouTube channel. You can maybe share this with your coworkers so they can learn a little bit about what Ed's been working on and Maybe learn about NaN. This is Scott Cagouarne for the PHP Architect Community Corner signing off to remind you, keep listening, keep coding, and keep reading.