Modern PHP in 2025: Tools You NEED to Know!
Estimated read time: 1:20
Summary
Nuno Maduro returns to India with a bang, presenting some of the most advanced tools you need to know for PHP in 2025. During his talk, he covers essential tools like Laravel Pint, Pack PHP, PHPStan, Rector PHP, and architectural testing, ensuring your code is efficient, consistent, and tested thoroughly. His engaging session highlights key features, practical examples, and implementation tips, wrapping up with strategies to integrate these tools seamlessly into your development workflow.
Highlights
- Nuno discusses the magic of Laravel Pint and its ability to streamline and professionalize PHP projects. ✨
- He introduces Pack PHP, which identifies typos in your code, making it cleaner and more professional. 📝
- PHPStan acts as a 'freelancer' that reveals code issues, making debugging more efficient. 🔍
- Rector PHP can update legacy PHP code to the latest standards in mere seconds, showcasing its power. ⚡
- Nuno stresses the importance of parallel testing to speed up testing processes. 🏎️
- The concept of code coverage is highlighted as a key method to visualize what parts of your code are tested. 📊
- Architectural testing with pre-set rules in Past PHP ensures codebase consistency and long-term quality. 📏
Key Takeaways
- PHP in 2025 requires understanding and utilizing tools like Laravel Pint, Pack PHP, and more for efficient coding. 🚀
- Rector PHP works like magic, automatically rectifying code errors and aiding in version upgrades. ✨
- Architectural testing in Past PHP offers presets that ensure your code follows set consistency rules. 🛠️
- Leveraging parallel testing significantly reduces test execution time, optimizing performance. ⏱️
- Using composer scripts simplifies the process for new team members, making tool execution straightforward. 👍
Overview
In his talk "Modern PHP in 2025: Tools You NEED to Know!", Nuno Maduro brings excitement and insight into the world of PHP development. With a spectrum of tools aimed at streamlining and upgrading your coding practice, he showcases indispensable resources like Laravel Pint for coding style adjustments and Pack PHP for automating typo corrections. These tools alone ensure that your code maintains professionalism and consistency across numerous projects.
Nuno takes the audience on a journey through powerful tools like PHPStan and Rector PHP. While PHPStan functions as an intelligent assistant pointing out code issues, Rector PHP goes a step further by automatically rectifying them and updating legacy code to the latest versions seamlessly. These tools exemplify the advancements in PHP development, making the development process smoother and more efficient.
Moreover, Nuno emphasizes the value of architectural and parallel testing methods. He demonstrates how constant monitoring through architectural testing ensures code consistency, while parallel testing drastically cuts down on test execution time, maximizing resource efficiency. Ending with tips on utilizing composer scripts, Nuno helps developers implement these tools effortlessly into their workflows, underscoring the evolving landscape of PHP in 2025.
Chapters
- 00:00 - 00:30: Introduction and Overview The speaker expresses excitement about returning to India after two years, introducing themselves as Nuno. They outline the topics for discussion including linting, fixing typos, type checking, modern syntax, parallel testing, type coverage, code coverage, and architectural testing in composer scripts. The speaker acknowledges the list of topics might seem overwhelming, but assures it will be manageable.
- 00:30 - 04:30: Laravel Pint Overview and Customization The chapter introduces Laravel Pint, a default coding style fixer in Laravel. It highlights the lesser-known fact that Laravel Pint can be customized. The speaker prepares to demonstrate the customization process by opening a PHP project in PHP Storm, described as the best editor.
- 04:30 - 06:00: Pack PHP for Typos This chapter introduces PHP Storm, an editor for PHP, and a fresh level app. The speaker discusses the ease of using pint PHP, emphasizing its simplicity and ability to style code with zero configuration and dependencies. The chapter hints at deeper functionalities that can be leveraged from laval pint if explored further.
- 06:00 - 09:30: PHPStan for Type Checking This chapter focuses on configuring PHPStan for type checking within Laravel projects. It highlights the use of a configuration file for Laravel Pint, which utilizes PHP Code Sniffer (PHPCS) fixer as part of the setup. The chapter details steps to direct Pint to apply the configuration across all PHP files, ensuring consistent code formatting and adherence to coding standards.
- 09:30 - 14:00: Rector PHP for Code Refactoring The chapter discusses the use of Rector PHP for code refactoring, particularly focusing on the automation of declaring strict types and marking every class as final. The speaker shares a method of running a tool called 'pint' which automatically updates every file in a project, regardless of its size, to add these declarations. This process greatly enhances the consistency and professional quality of the codebase by systematically applying these changes across thousands of lines of code.
- 14:00 - 16:30: Parallel Testing with PASTA Chapter titled 'Parallel Testing with PASTA' explores the use of Laravel Pint, describing a personal configuration preference. The user expresses enjoyment in utilizing private functions, detailing a configuration setup where private methods in a class are hierarchically ordered beneath all public methods, emphasizing the importance of public methods.
- 16:30 - 23:00: Code and Type Coverage The chapter discusses the benefits of using Code and Type Coverage tools, particularly focusing on the functionalities of Label Pint. An example is provided to demonstrate how private functions and expressions are handled, emphasizing how Label Pint organizes code efficiently. It also illustrates a comparison operation between an integer and a string, highlighting common assumptions about the result of such comparison in code execution.
- 23:00 - 31:00: Architectural Testing with Presets The chapter titled 'Architectural Testing with Presets' delves into the challenges of dealing with non-strict typing in PHP, particularly when using '==' for comparisons which can lead to unexpected true results. The author suggests using '===' for strict comparisons to prevent these issues. Furthermore, the chapter mentions configuring 'pint'—a tool that can automatically replace instances of '==' with '===' in the codebase, simplifying the process and enforcing best practices for comparison in PHP.
- 31:00 - 32:30: Composer Scripts for Streamlining Processes The chapter 'Composer Scripts for Streamlining Processes' explains the use of Laravel Pint to maintain clean and consistent code in legacy projects. It details the steps to modify the pint.json file by setting an option to 'strict comparison' to true. This adjustment enables the automatic addition of the triple equals in the code, which helps ensure code quality and consistency across projects.
- 32:30 - 33:33: Conclusion and Closing Remarks In the chapter 'Conclusion and Closing Remarks,' the author highlights a significant advantage of using Laravel, noting it provides a substantial benefit by default. The conversation then shifts to discuss a recent development: a tool called 'pack php.' Developed over the past two months and during live streams, this tool is designed to automatically detect and correct typos in projects.
Modern PHP in 2025: Tools You NEED to Know! Transcription
- 00:00 - 00:30 no no no no oh boy feels so good to be here back after 2 years i love you so much India for those who don't know me my name is Nuno and today we are going to talk about linting fixing typos type checking modern syntax parallel testing type coverage code coverage architectural testing in composer scripts looks overwhelming but honestly it's super
- 00:30 - 01:00 easy and I'm going to show you how the first tool I want to talk about is Laravel Pint okay and probably some of you already know Laravel Pint is this amazing coding style fixer that just comes by default in Laravel however a lot of people don't know that they can customize Laravel Pint so let me just show you i'm going to move here into this uh PHP's project open with the best editor in the world PHP Storm yeah I
- 01:00 - 01:30 know that here is PHP Storm right in our editor right here with a fresh level app and the way you guys know pint PHP it's kind of easy right you just unstyle your code just like that you go to your terminal bam you run pint and automatically gets style this is what we know about pint right it just works zero configuration zero dependencies just like magic however I want to show you that you can actually take so much more from laval pint if you learn how to
- 01:30 - 02:00 customize your pint.json so I'm going to go here all the way down and I have this pint uh uncomment me.json so I'm going to do that so Pint starts using this configuration file and what I have here is basically a way of configuring the underlying tool behind Laravel Pint which is PHPCS fixer and I'm going to tell Pint to do the following go to every single PHP file you find and add
- 02:00 - 02:30 declare street types on the top of it and go to every class you find and make every class final so what I'm going to do here is clear my terminal run pint and automatically just by magic pint go to every single file I have and adds declare streak types and the final classes on every single class I have this is really useful because you can have a project with thousands of lines and automatically pint just makes the code super professional and consistent
- 02:30 - 03:00 even better something I really like about Laravel Pint is especially when you have this configuration file is I like to have private functions you probably also like that to have them and something cool about this is that I have strictly configured with my Laravel pint to order everything within my class in the following order right here so for example I want all the private methods to be under my class below because what it matters is really the public stuff so
- 03:00 - 03:30 if I do this if I have this private function on top I clear my terminal run pint and pint automatically will move everything all the way down it really just works and I want to show you something that I also like about Label Pint i'm going to uncomment this DD expression okay I'm literally comparing one as an integer with this huge string and possibly most of you will think that when I run this code the result is false
- 03:30 - 04:00 however when I run the this code the result is true i know what doesn't make any sense um so this is basically happening due the nature of PHP which does not does strict typing so to address this issue I typically recommend people to use triple equal or strictly uh comparisons but you can actually you can actually configure pint to basically replace every single two weeks with three it's kind of easy you just go to
- 04:00 - 04:30 your pint.json file you go all the way down and you put this in option call it street comparison to true you go back to your file just like that you run pint and hopefully pint will automatically add the triple equals so this is really useful again imagine a legacy project you can just set these rules in your pint.json file and automatically you have your code really clean really consistent so this is Laravel Pint it's
- 04:30 - 05:00 already available on Laravel by default so it's a huge quick win for you all i want to move forward and talk a little bit about something a little bit more recent i don't know if you guys know but in the last two months I actually have developed yet another tool this one is called it pack php and it was developed actually during my live streams and what it does is kind of simple just goes to your project and fixes typos automatically let me show you i'm going
- 05:00 - 05:30 to move here back to my PHP storm editor and the only thing I'm going to do here is go to the console and type vendor bean pack once I do this pack goes to every single file I have and just tells me typos things that make your code kind of unprofessional so the first typo is detecting is under this person value object and indeed I have a typo here i have name with double E which is obviously a mistake now imagine having
- 05:30 - 06:00 to go to every single file of your project and detect typos manually kind of cumbersome right so what you can do run pack pa pack will just point you in the right direction obviously we have a typo on the annotation so we can fix that real quick if I do that and I run pack now I'm going to jump from two misspellings to just one and I'm going to fix as well on this method bam bam boom run pack and now we have pack happy as well thank
- 06:00 - 06:30 you you guys are awesome i I really love that energy that what made me come come back to India really uh you guys are just unbelievably awesome thank you this is pack php it doesn't come by default in lot but you can require it through composer and it really just works moving forward PHP stand and honestly if you're doing PHP in 2025 without this what the heck are you even doing okay PHP stand
- 06:30 - 07:00 is the equivalent of Typescript but for PHP and yes we have types in TypeScript before TypeScript was even a thing in PHP and it really just works is type checking and all of you love types correct someone told me on the audience that they were not using types so I got confused types are awesome and PHP stem with types is even better let me show you I'm going to move back into this project And without opening or seeing
- 07:00 - 07:30 anything the only thing I will do is come here and type PHP stand and again just like pack actually I do need to remove this DD come on DD the best debugger in the world just doing this for me it's just amazing to see the love for DD on this audience amazing all right folks running PHP stand and guess what php stand automatically goes
- 07:30 - 08:00 to every single file like just like pack or pint and just tells me what is wrong it's just like having this free freelancer working for me and just tell me what is wrong so I'm going to go here into this output of PHP stand and obviously there's a couple of things we need to fix right php stand is pretty much complaining about everything so let's go to this article controller which is one of the places PHP stand is complaining about so PHP stand is telling me the
- 08:00 - 08:30 following um on the line 18 you have some unreachable statement so it's the way of PHP stand telling me that this code on the line 18 which is this return view is never executed this typally typically happens because um we have a unreachable like a die or a or a DD so I can basically come here is the microphone okay i hope it is right so typically happens because we have a DD which is kind of dying the code so the line 18 is unreachable i can
- 08:30 - 09:00 just do this run PHP stand right here and now we are going to jump from three to four so we have even more problems let's see what's happening here so confusing what the okay makes sense actually PHP stand is actually very smart so it's telling me the following that on the index method I'm trying to return an integer but however I'm returning a view obviously a mistake i'm going to go here fix this issue real quick bam bam boom run PHP stand and we are back to three okay this is cool
- 09:00 - 09:30 we're a little bit better the next problem is that the article doesn't have a method all okay it's an uncloned class so we forgot to lally import this article class i'm going to import with the help of PHP storm run pass ph uh PHP stand again and we are back to zero problems whatsoever it's such a cool tool you run it on a terminal really just [Applause] works php stand it's not included by
- 09:30 - 10:00 default in Laravel however you can use PHP stand combined with Last Stan which is kind of a wrapper around PHP stand to understand all of the Laravel lovely magic and you can start using this today again a huge quick win just like pack or pint now I want to talk about something that I have discovered a couple months ago but honestly it's impossible to talk about PHP stand without talking about this thing right here ractor PHP is just
- 10:00 - 10:30 the best thing in the planet works like magic and honestly if PHP stand tells you what is wrong Recctor PHP automatically fixes those problems for you looks impossible honestly I'm going to show you it's just crazy and on top of that some of you told me today on the audience that you have some PHP 5 whatever application and you want to migrate to the latest versions recctor PHP can do that for you in less than a second so I'm going to show you some
- 10:30 - 11:00 examples moving here uh back to this PHPtorm editor and I'm going to show you this user controller okay I'm going to uncomment this and let's just see this code all together there's a few things here immediately what the heck is this even this syntax right here i don't do arrays like this i was probably not even a PHP programmer when this was a thing on top of that we are using switch statements which is in case you don't know something a little bit outdated php
- 11:00 - 11:30 developers now use match statements and there is other problems for example uh we are kind of doing this if condition that just says user equals to user makes no sense at all this is what I like to code or call that code on top of that we have this uh index public uh function fully untyped so I don't have a return type right here so let me show you something i'm going to show you recctor php i'm going to go here and again just like the other tools I'm going to type
- 11:30 - 12:00 recctor okay vendorbin recctor i'm going to run this and just check this out automatically in less than 3 seconds okay we just have reactive php coming into this thank you recctor PHP coming into this adding the missing return type changing that weird syntax to proper array in PHP and finally replacing a switch statement to a match statement automatically imagine
- 12:00 - 12:30 having thousands of files thousands of files in legacy PHP code and bam just like seconds you have that migrated to PHP 8.4 it's latest version right yes that being said I want to show you also how Recctor PHP is useful removing death code okay so I'm going to go here into my Recctor PHP file by the way all these tools I have showed you I'm just show you the default stuff there is so much more on these tools recctor PHP is a
- 12:30 - 13:00 great example watch this i came here to the Recctor PHP configuration file and I've already instructctor PHP to do a bunch of stuff one of the things I have intentionally left out is removing the death code because it's one of my favorite features so I'm going to go here and pass this to true so I want Recctor PHP to remove all the dev code then I'm going to go back to my user controller and watch how Recctor PHP automatically in a second refactors all of this removing the code we don't need
- 13:00 - 13:30 clear the terminal run ranker and again automatically record php will just remove all the code we don't need and as you can see bam it just worked we are now returning the user without that weird if condition and on top of that we have removed the temporary result condition so this is Recctor PHP again a huge quick win you just installed this in your project zero breaking changes so even if you run this in your project it
- 13:30 - 14:00 won't affect the desired outcome so we have seen a lot right we have seen a lot but I want to shift a little bit now into past and before we talk about parallel testing in particular I want to acknowledge something and all of us in PHP community should be proud of this besides past being popular it's also without question probably the most complete testing framework in the planet okay when you compare things like past against vest or
- 14:00 - 14:30 other testing frameworks they don't have things like past have snapshot testing mutation testing architectural testing code coverage type coverage just doesn't stop you know so we should be proud of this but one of the things that really breaks my heart is seeing that people are still not leveraging parallel testing and honestly unless you enjoy a huge coffee break there is no reason why you're not using parallel testing in 2025 it really just works and I want I
- 14:30 - 15:00 want to show you let's go here back to this project and I've created this dummy example with a bunch of features so this is this is literally four files as you can see on the bottom left four files and every single feature test it's basically sleeping for two seconds okay and I'm going to pretend that I don't know that parallel testing exists and I'm going to run past php without any parallel testing whatsoever we have four tests every single one sleeping for 2 seconds so obviously the outcome of this
- 15:00 - 15:30 test will be probably around 8 seconds and it is you can see here is about 8 seconds this test suite but we don't have bad computers anymore we have literally a MacBooks M4 with 17 machines or cores so why not leverage the full power of these machines with the language we love this is what PH parallel testing is about i'm going to clear my terminal run the same thing but just providing the flag d-pal and we are
- 15:30 - 16:00 going to jump from 8 seconds to simply 2 seconds we stop running the tests sequentially to run them in [Applause] parallel and finally leveraging a little bit the expensive computer that I bought right yeah this is parallel testing again it just works uh by the way behind the scenes Laval because of the way it's fully integrated with past we are going to give a different database to every single worker in uh running parallel
- 16:00 - 16:30 testing but also different cache a different file system really just works moving now to one of my favorite topics which is co which is code coverage and if you don't know what code coverage is it's basically this report that gives you the given by the test suite and it tells you what is being tested in your project tells you exactly what is missing tests and you will see a lot of people gurus of testing telling you that code coverage is a waste of
- 16:30 - 17:00 time i'm going to tell you something i rather jump to a test to a project full of tests than jumping for a project with zero tests okay with zero coverage okay so code coverage is important really points you in the right direction and I'm going to show you an example here on this project i'm going to make this a little bit bigger and again just like the other options a huge quick win and it really just works with past i'm going to just provide this uh past- coverage
- 17:00 - 17:30 when I do this past will run the test suite just like normal but at the very end we'll show you the most beautiful report you will ever seen in your life right there code coverage report telling you exactly what is being tested and what's not being tested and one example is if I see right is this user controller with zero test whatsoever so as you can see user controller have 0% of uh test suite of tests so to address this issue I can go to the user
- 17:30 - 18:00 controller and understand what's happening I can see for example that this index function is returning one two three or 465 five depending of the type I can effectively go to this user controller test and try to uncomment here some tests which effectively test the behavior of that controller run my test again this time again with a d- coverage and automatically we're able to understand that our user controller now
- 18:00 - 18:30 have some tests we jumped from 0% to 85% and the only thing not being tested is the line 27 7 as given and showed by the code coverage report so as you can see line 27 is this new show method so really points you in the right direction okay and watch this out also works like magic with a parallel testing flag so if I do d-parallel and also d- coverage I get the code coverage report even though
- 18:30 - 19:00 I'm running the test suite in parallel so fully integrated with parallel testing and it's a really nice and handy report this is code coverage i'm going to show you one more thing about code coverage that I really like uh which is the d- minimum option something important about code coverage is not only making sure we have a big code coverage in our project but also making sure that if someone makes a new pull request without tests you are going to
- 19:00 - 19:30 tell them okay so how to do that basically we can provide this option- minimum and if you provide for for example in your CI that the minimum coverage is 40% you can just provide that on the d-minimum option right there on the top and now past php hopefully will fail this test suite because the new code doesn't cover uh those 40% really useful and obviously if I were to run this with 30% the test suite would pass this is really useful because you
- 19:30 - 20:00 can literally ensure that everyone contributing to a project doesn't at least get the code coverage below the expected this is code coverage uh equally available on past works with parallel and it's really cool now code coverage is not the only thing we offer code coverage wise we also offer you something really cool called it type coverage and this one is less known is one of the features that you won't find on any other framework or
- 20:00 - 20:30 different languages such as um Java or JavaScript so here for example I want to talk about this type coverage because it's probably one of my favorite things we have on past unlike code coverage which tells you what is not being tested type coverage will tell you what is not being typed so I'm going to show you an example and you can sleep like a baby like this message here moving here to the console and what I will do here is just run vendor bean
- 20:30 - 21:00 past d-type coverage okay I'm going to do that run on the console and super fast passphp will tell me that I'm using types pretty much everywhere thanks to this 100th uh percentage of types so I'm going to uncomment so you can see the example uncomment this class car which obviously is missing a bunch of types since seems like PHP back in the days i'm missing a type on this property i'm missing a type on this constant and yes
- 21:00 - 21:30 types can be on constants and I'm equally missing a type on the argument and on the return type if I'm not mistaken here we go so if I run now type coverage with this new class that I just have introduced it past PHP will tell me right there that my type coverage is below expected i'm not anymore with 100% because I have this car class obviously missing a type on the line 9 i can just go there and fix the issue make this a little bit more modern constant on live
- 21:30 - 22:00 11 i'm going to type this as well and finally a parameter on line 13 i'm going to uh add a type here and obviously I return type on the line 13 okay I do this i run type coverage and hopefully you are back to 100% which we are and again type coverage is like any other tool we have thank [Applause] you type coverage is just like any other tool we have really just works zero pain
- 22:00 - 22:30 just takes two seconds to implement in your test suite and in your team and it really just works and guess what works like magic as well with things like minimum so the API of past you will see that is very consistent and cohesive options like minimum you will find all over the place so something I can do here is provide for example minimum 100% and obviously now we are at 100% but if I were to come here and untype something or a new pull request coming into your
- 22:30 - 23:00 project without types type coverage will tell you immediately no no we are not merging this because you are obviously below 100% so this is type coverage also a huge win for your team can be implemented almost with uh no time i want to also talk about architectural testing and funny enough uh Vichel was telling here when I was first coming into Lakon India that was
- 23:00 - 23:30 two years ago i have introduced this architectural testing feature on past PHP and again something unseen on any other testing framework on other languages just like JavaScript so I want to show you how this architectural testing feature have evolved during the years um and if you don't know what it is it's pretty much a way of ensuring that the architectural quality of your project stays consistent over time so let me show you i'm going to move here
- 23:30 - 24:00 into this project and I'm going to open uh this arch test example so when I came to India the first time if I'm not mistaken I was introducing the granular way of defining expectations architecturally in your project so you could come here for example and write things like I expect my controllers uh to to be final to not extend anything to only have the method xyz blah blah blah all that stuff this is the way we have
- 24:00 - 24:30 kind of introduced architectural testing and it was kind of a successful way of introducing this feature however people were requesting I want the preset i want like your architectural testing rules and they need to be like oneliner so we have introduced it recently this year this presets feature and the way it work it's kind of simple it's a group of granular architectural rules let's start with the most simp with the most simple one which is this preset PHP and as you
- 24:30 - 25:00 can guess works with any PHP framework works with anything there are really general rules around PHP that you might want to have in your project let me show you an example hopefully this is just passing the last time I run this here we go but I'm going to make this fail i'm going to go to this arch example and let's uncomment this class uncommon this class i'm going to go here run venderbin past with d-archch
- 25:00 - 25:30 and let's see how it goes so the preset PHP is complaining about this expecting debug_zvalue dump not to be used what is this exactly we have no idea what this is so you probably shouldn't be using and this is exactly what this PHP preset is about it's telling you about the things within PHP that you shouldn't be using this function right here i don't know what it does but I do know it's an internal function of PHP and you should
- 25:30 - 26:00 not be using it so this preset will tell you exactly what you shouldn't be using in general around the PHP language things like die exit and things like that so let's just Oh interesting are you guys using herd already so I'm going to comment this and make my test suite happy and hopefully is happy now now this is a very basic preset i'm using it already but I really
- 26:00 - 26:30 like as well the security preset this one is funny gives you general guidelines about security in your project so I'm going to run this on my test suite and passphl this MV5 this MD5 should not be used so this security preset will tell you about the things you shouldn't be doing security-wise and in case you don't know you better know but in case you don't MD5 is no longer secure okay
- 26:30 - 27:00 re relax but you can do it afterwards you can change it afterwards but MD5 is no longer secure so what I will do here is go to my arch example and replace MD5 to ash my password this is not okay not secure lol so I'm going to go here and replace this with brypt which is a little bit more secure went past PHP and is not complaining anymore and again these presets get automatically updated so if there is any function which is a
- 27:00 - 27:30 concern security-wise patch PHP PHP will tell you immediately okay so this is a security preset and I want to show you one more preset which is personally one of my favorites possibly yours as well if you start using this i want to show you this preset it's called the Laravel preset and it basically contains a way of ensuring that you code all applications just like I do we'll ensure that all your models are placed
- 27:30 - 28:00 within application models will ensure that you have form requests and much more let me show you an example i'm going to go here uh uncomment this Laval preset run it on my terminal bam bam boom and the first thing is complaining about it's kind of interesting it's really an architectural rule i don't know about you but I like to keep my controllers super simple i want my controllers to only have the restful methods to only have index show create store update edit delete and
- 28:00 - 28:30 destroy i like to keep my controllers insanely simple just like Adam Won a few years ago cuddy by design this preset actually enforces that so if I go to my article controller right here you will see that I'm using this publish method if I need the publish method I do an article publish controller with an invocable method okay this preset ensures that so what I will do here just
- 28:30 - 29:00 to make the test happy is guess what removing the method and hopefully my test suite is happy and it is but it's now complaining about the different thing this time my test is complaining about something funny which is is expecting everything within application models to extend illuminate a eloquent model so I effectively created a file with the name product but I forgot the most basic thing which is implement the
- 29:00 - 29:30 model or extend the model of Laravel let's keep going run again past architectural uh testing and as you can see we'll really just guide you if you start installing this today in your project will just guide you about what is wrong and you can see that now is complaining about something funny again this wrong product exception is not implementing the throwable interface of PHP i don't know about you I have seen this thousands of times and it happens when I'm forgetting to extend the base
- 29:30 - 30:00 exception of PHP and hopefully uh architectural testing is now happy which it is so all these presets they are one line of code okay one line of code thank [Applause] you so if you tell me that you don't have time to put one line of code in your test suite come on literally a line of code okay um I want to also show you something really cool about this i hope
- 30:00 - 30:30 we have time uh on this um architectural testing we obviously you also obviously can write your own rules okay this is general rules around laval PHP security and more and there's also the preset but if you really want you can write your own rules so the things you can do is for example things like this expect everything on my controllers to be read only to be final like literally you can specify all the custom rules to ensure consistent in your project one example
- 30:30 - 31:00 is for example I don't like my controllers to extend anything and hopefully my test will be happy now and it is but if I go here to this user controller and I do this the dummy thing on the planet which is extend this controller class for example if I do this hopefully my test will start complaining and you can ensure consistency by saying no no nothing should extend anything here and now your test suite is again happy so you can literally specify architectural granular
- 31:00 - 31:30 rules such as for example ensuring that your models are only using repository classes for example anything really just works so this is architectural testing equally available in passph and it just works i want to finalize this talk by giving you a really good tip we talked about a bunch of tools pint pack PHP 10 Recctor so many tools and honestly it might get a little bit overwhelming you might know me know them all but if
- 31:30 - 32:00 someone is joining your project just leading with all of this it might get a little bit confused so I'm going to give you a tip where they don't have to know these tools let me show you something that I always do is on my composer.json file I create this list of scripts okay it's super simple you are simply saying to composer every time someone types composer lint just execute whatever is here so if I type composer lint will
- 32:00 - 32:30 automatically run pine behind the scenes even better I can say every time someone types composer factor just run reacttor php and the person running this script doesn't have to know any flags any configuration just have to execute the script so here for example I can clear my terminal run composer refactor and this will run recctor php for me now the best one in the planet is this one get ready you can literally say now create and prefix this test prefix with type
- 32:30 - 33:00 coverage type uh test linting test uni test types test refactor test everything and finally put them all under this test script and guess what the newcomer to your team that new person joining your project the only thing they have to do is type composer test and this will run everything linking refactor type coverage PHP stand refactor and much more and it really just
- 33:00 - 33:30 [Applause] works my name is Luna Maduro in case you don't know I'm on YouTube right now publishing videos every single day at 1 PM but also doing live streamings every single day at 900 PM if you love my work if you love this talk join me on my YouTube channel i love to be here in India and I want to catch you all right now on the after party thank you so much and catch you all next time [Applause]