archive-com.com » COM » S » STUARTHERBERT.COM

Total: 477

Choose link from "Titles, links and description words view":

Or switch to "Titles and links view".
  • Stuart on PHP - » Series: Beyond Frameworks – PHP Components
    installed the tools But now what In these blog articles I show you step by step how to build the components for an app and discuss many of the subtleties that you ll come across with this approach Planning An App That Uses Components Decomposing An App Into Components Creating A Skeleton Component Setting Up Your Component s Metadata Pt 1 Setting Up Your Component s package xml File Adding Unit Tests For Your Component Where To Put Your Component s Unit Tests How To Run Your Component s Unit Tests Dealing With PEAR Dependency Quirks Working With Non Namespaced Components Testing Remote Web Services The Quick And Nasty Way Unit Test Coverage For Components Making A PEAR Compatible Package Setting Up Your Own PEAR Channel 3 Tips For Publishing Your Own PEAR Channel Publishing Your PEAR Channel On GitHub Anatomy Of A Component Want to know what is inside each component or where something is meant to go Here s the skinny Explaining File Roles In PHP Components Shipping Reusable PHP Code Shipping A Command Line Program Shipping Data Files With Your Components Shipping Documentation With Your Component Shipping Unit Tests With Your Component Shipping Web Pages With Your Component Common Principles And Practices Become a successful part of a wider community of PHP developers creating components that adopt common principles and practices Introducing Common Principles Of Components coming October 10th 2011 More to come About The Author Stuart has been writing PHP applications since 2003 and has been contributing to open source software since 1994 He was an early writer for php architect a co author of the Official Zend Certification Study Guide for PHP 4 and a regular speaker at conferences and user groups since 2004 When he s not designing software Stuart loves to explore the world through a camera lens spend time with his beloved guitars and continue his study to T ai Chi Chu an Taijiquan No Comments Stuart Herbert on Beyond Frameworks PHPtrends net says March 31st 2011 at 11 25 am and all around nice guy has been posting a series of posts on his blog based on his PHPUK talk Beyond Frameworks There are a grand total of 13 posts all made within a 7 day period an astonishing feat to say Emran Hasan says May 7th 2011 at 11 54 am Hi Stuart That s an excellent series you re writing and it s moving along nicely Can you share with us when you re planning to write the next parts I believe you have some more code to show as how to slowly complete the project Looking forward to your response and thanks for the series Emran Khayrattee Wasseem says February 27th 2012 at 11 03 am This is a GREAT set of article and your ideologies make very much sense I like the idea of decoupled components layering them AWESOME work A must read for any PHP programmer Wasseem Latest Photos Categories phpnw 1 Beginner 2 Intermediate 3

    Original URL path: http://blog.stuartherbert.com/php/php-components/ (2016-05-02)
    Open archived version from archive

  • Stuart on PHP - » Talks
    you tell In this talk Stuart will show you how you can use off the shelf open source tools to work out what your ORM is doing and whether or not it is the cause of your performance problems He ll show you how to measure the database itself and the ORM code as well as providing useful strategies to reduce the cost of your ORM without having to abandon the ORM altogether Finally he ll show you how you can extend these techniques to other parts of your application so that you re never in the dark again Be the first to leave a comment Talk Introducing A Quality Model For MVC Applications Posted by Stuart Herbert on October 8th 2015 in phpnw Talks Here s the original blurb for this talk Your integration functional and non functional testing gives you a good idea if your code will work on Production But how do you go about measuring the quality of code that already seems to work How do you make that measurement repeatable How do you share it with clients in government finance or other large enterprises who are looking for a 3 5 year shelf life from your code In this talk Stuart will introduce you to SQuaRE the international standard collection for software quality He ll give you a tour of all of the available and upcoming standards in this area before taking a deep dive into the Product Quality Model from ISO IEC 25010 2011 He ll explain what a quality measurement is how you link them to your project s quality criteria and how you incorporate them into code reviews QA teams and management decisions You ll leave this talk ready to start measuring and improving the quality of your product or service with

    Original URL path: http://blog.stuartherbert.com/php/category/talks/ (2016-05-02)
    Open archived version from archive

  • Stuart on PHP - » 3 – Advanced
    of any other issues you find along the way for you to come back and address at a later date Stay on target and park potential tangents and distractions for another time Although this sounds like a slow process when described on paper with practice it can be executed at high speed during an emergency situation However the need to restore service in a timely manner isn t always compatible with this approach and you re normally better off returning to your test environment where you can study the fault without inconveniencing your customers any further Be the first to leave a comment Making IIS Practical In Production For PHP Posted by Stuart Herbert on December 17th 2008 in 3 Advanced I was just reading Derick s post about the recent get together with Microsoft and it occurred to me that so far I haven t seen anyone mention anything about the single most important problem with running PHP in production on IIS After a bit of digging it looks like the problem has been sorted since the initial IIS 7 release presumably if you re still running Windows Server 2003 you re still screwed on this one but I d love to hear from folks who have definitely done this in production Let me explain the background first When you run PHP apps using IIS you re much better off using IIS s native CGI support slow but rock solid as of Windows Server 2003 SP1 or the new FastCGI support that was released last year or the year before faster but I haven t tested it personally under serious stress as I ve managed to move back to working exclusively on Linux this year I ve tried PHP via IIS s ISAPI interface but as that requires running PHP in a threaded environment I ve never had any luck in getting it working in a stable manner over the years Besides iirc both Microsoft and Zend recommend running PHP using FastCGI on IIS anyways Running PHP via CGI and FastCGI means that IIS has to do the Windows equivalent of fork ing off PHP processes to do the actual PHP bit If your box has too many PHP processes running the box will start to swap Once a webserver starts swapping you ve no chance in hell of keeping up with all the incoming requests and your websites on that particular webserver become unavailable in a matter of moments Restarting IIS will clear off all the PHP processes but if demand remains the same the webserver will start swapping again very soon and you re back to square one your websites back to being unavailable to the outside world With Apache and mpm prefork mpm peruser or mpm itk you can adjust Apache s settings to make sure that your server never swaps With Apache and PHP FastCGI you can do this too by adjusting the number of FastCGI processes created Although atm I don t recommend using Apache PHP FastCGI in production environments But how exactly do you do this with IIS and PHP CGI or PHP FastCGI The answer can be found in the IIS 7 documentation It looks like you can limit the number of FastCGI instances per application pool IIS best practice is to setup a separate application pool per website IIS s architecture is nothing like Apache That s fine for servers running just the one website but is there a way to set a similar limit that applies across all application pools It would be great if there was And I m not sure that there s a way to do this with CGI if you have problems with FastCGI crashing Love it or hate it Windows Server is the right choice for many firms and the better PHP runs in a Windows Server production environment the more opportunities there are for firms and individuals that create PHP apps in the future Be the first to leave a comment Can You Secure A Shared Server With PHP FastCGI Posted by Stuart Herbert on October 7th 2008 in 3 Advanced The Web Platform The challenge with securing a shared hosting server is how to secure the website from attack both from the outside and from the inside PHP has built in features to help but ultimately it s the wrong place to address the problem I ve already written about a number of solutions that work but one option I ve been asked time and time again to look at is using PHP FastCGI The belief is that using FastCGI will overcome the performance issues of Apache s suexec or mod suphp because FastCGI processes persist between page views But before we can look at performance the first question is how exactly do we get PHP and FastCGI running as different users on the one web server in the first place Installing And Configuring mod fcgid for Apache Stock Apache does not ship with built in support for FastCGI You need to download and install a third party module There are two choices the original mod fastcgi and the more recent mod fcgid which I ll look at in this article Before we start make sure that you have built and configured Apache to use suexec We will reuse suexec to ensure that our FastCGI PHP processes run as different users Most Linux distributions already include a package for mod fcgid you should be able to install it using your distro s package manage The version I ve tested for this article is mod fcgid 2 2 running on Seed Linux a Gentoo based distro After installing mod fcgid make sure that you edit your Apache config files and comment out any lines that load mod php They will look like this LoadModule php5 module modules libphp5 so Then add the following lines to your virtual host SuexecUserGroup myuser mygroup Directory var www localhost htdocs AddHandler fcgid script php Options ExecCGI Allow from all FCGIWrapper var www localhost cgi bin php fcgi php Directory Replace myuser with the user who owns the website and replace mygroup with the group that the user belongs to This sets the privileges that PHP will run as when this website is visited Because suexec is understandably paranoid about what CGI programs it will run for you to make mod fcgid work in a shared hosting environment we need to create a FastCGI wrapper script owned by the same user that owns the website bin bash PHPRC etc php apache2 php5 export PHPRC PHP FCGI CHILDREN 4 export PHP FCGI CHILDREN PHP FGCI MAX REQUESTS 5000 export PHP FCGI MAX REQUESTS exec usr lib php5 bin php cgi Each website needs its own copy of the script Place this script in the website s dedicated cgi bin directory This should be a directory that you control to make sure that malicious scripts cannot be uploaded to take advantage of suexec Make sure that the script is owned by the user and group who owns the website otherwise suexec will refuse to run the script and you ll spend quite a bit of time scratching your head wondering what the problem is The FastCGI wrapper script gives us an opportunity to set limits on how PHP works as a FastCGI process We can tell it how many FastCGI scripts are allowed to run to make sure one website doesn t use up all of the web server s free capacity and also how many HTTP requests each FastCGI process should handle before terminating to limit the impact of memory leaks At this point you can restart Apache and you should find that your websites are now using suexec FastCGI to run as separate users Making Apache Go Even Faster One of the major benefits of using Apache 2 2 over Apache 1 3 is the ability to switch how Apache works at the fundamental level Apache MPMs multi processing modules can emulate Apache 1 3 s behaviour mpm prefork but it can also provide new options By default most if not all Linux distributions install Apache 2 2 built with mpm prefork but by switching to another MPM can we make our websites go even faster If you are using suexec mod fcgid on Linux there are two MPMs available to you that have the potential to boost performance further mpm worker and mpm event Both MPMs turn Apache into a multi threaded server On Linux systems it is usually much quicker to create new threads than it is to create new processes The downside is that software has to be specially written to work correctly in a multi threaded application known as being thread safe mod php doesn t work reliably with mpm worker and mpm event because it reuses a lot of third party code that may or may not be thread safe But because we re running PHP in a separate FastCGI process we can safely turn Apache into a multi threaded server Some Benchmarks To benchmark PHP FastCGI suexec I used Apache s ab benchmark to load a simple phpinfo page 1 000 times I ran the benchmark five times and averaged the results To compare the results I repeated the tests against mpm worker mpm event and mpm prefork both with and without mod php mpm worker mod fcgid PHP FastCGI suexec 7 36 seconds 0 2 failure rate mpm event mod fcgid PHP FastCGI suexec 7 75 seconds 0 2 failure rate mpm prefork mod fcgid PHP FastCGI suexec 7 92 seconds 0 2 failure rate mpm prefork mod fastcgi PHP FastCGI suexec 8 52 seconds 0 2 failure rate mpm prefork mod php 7 38 seconds 0 failure rate Other Considerations The performance is good especially if you switch Apache MPMs These benchmarks are extremely simplistic and what they don t show is that switching to mpm worker and mpm event will probably speed up your websites even further because these Apache MPMs handle downloading images more efficiently than mpm prefork can You may also be able to scale your websites better before having to upgrade your servers or add additional ones especially if you use a bytecode cache such as APC or xcache But what are the downsides As with straight suexec you can t use HTTP authentication in your application Hardly any apps rely on this functionality any more probably because so many shared hosting servers use suexec Your server may require extra RAM to cope with the number of FastCGI processes running simultaneously You may need to switch to a 32 bit Linux kernel that supports PAE or to a 64 bit Linux distro Apache PHP FastCGI is not 100 reliable in my testing Conclusions It is possible to combine PHP FastCGI and suexec to produce a solution that secures a shared hosting server and at the same time provides good performance compared to the alternatives If you re prepared to compile Apache from source and switch MPMs you can squeeze even more performance from this combination and perhaps even out perform the venerable mod php Unfortunately my experience was that the PHP FastCGI combination cannot be trusted to serve pages 100 of the time The average failure rate was 2 requests per 1000 and the failure rate was consistent no matter which Apache MPM was used which Apache FastCGI module was used and how many thousands of requests I used in my testing At the time of writing I haven t tracked down the cause of this failure and it may not appear in your own environment but none of the previous solutions I ve looked at in this series have displayed this problem so it s something to think about before chosing PHP FastCGI to serve your websites I m hoping to find time in the future to get to the bottom of this problem if no one gets there first As a result I can t recommend using PHP FastCGI suexec at this time My current recommendation is mpm itk which has successfully served millions of page hits for me in production over the last few months References This article was made possible by information already on the internet http interworx com forums showthread php p 8327 http ckdake com projects documentation php security This article is part of The Web Platform an on going series of blog posts about the environment that you need to create and nurture to run your web based application in If you have any topics that you d like to see covered in future articles please leave them in the comments on this page 14 comments 40 Firefox Extensions Every Web Developer Should Check Out Posted by Stuart Herbert on June 16th 2008 in 1 Beginner 2 Intermediate 3 Advanced Toolbox as recommended by readers of Planet PHP Most Recommendations There were six Firefox extensions that folks repeatedly recommended ColorZilla advanced eyedropper color picker page zoomer and other colorful goodies FireBug live DOM CSS inspector The single greatest web developer add on for Firefox Live HTTP Headers view HTTP headers of a page and whilst browsing Web Developer Toolbar adds a menu and a toolbar with various web developer tools YSlow Yahoo s tool for analysing web pages and telling you why they are slow Requires Firebug Zend Studio Toolbar debugging assistance for Zend Studio 5 5 and earlier Isn t mentioned on the Zend Studio 6 pages so does that mean it is now obsolete and after that there was a lot of variety amongst the other extensions that were recommended Also Recommended Cache Status easy cache status management from the status bar ChatZilla IRC client for Firefox Duplicate Tab clone a tab along with its history Edit Cookies edit your cookies right in Firefox Fasterfox performance and network tweaks for Firefox Firefox Accessibility Extension test your web pages for functional accessibility features based on the iCITA HTML Best Practices FirePHP print to your Firebug console using a simple PHP function call FireShot take screenshots of web pages and a whole lot more Google Toolbar Google s famous in browser search toolbar GreaseMonkey customise the way a web page displays using your own Javascript add ons See also Lifehacker s Top 10 Greasemonkey User Scripts and their Better GMail and Better Flickr add ons to get an idea of just what can be done with Greasemonkey as a Firefox extension tool HTML Validator add HTML validation to your browser IE Tab Windows only open Firefox tabs using IE s rendering engine See also the popular IE View alternative LocationBar2 adds additional features to Firefox s address bar Lorem Ipsum content generator Generate Lorem Ipsum dummy text for when you need to fill a page with content for testing purposes MeasureIt draw out a ruler to get the pixel width and height of any element on the web page NagiosChecker see the status of your services and servers in Firefox s status bar You do monitor your servers right PrefBar power user toolbar for Firefox Regular Expressions Tester testing tool for regular expressions with colour highlighting RefSpoof easy spoofing of the HTTP referrer header ReloadEvery reloads a web page every so many seconds Save Session save your current browser windows tabs for the next time you open Firefox Scrapbook save web pages locally and easily manage collections Like OS X web archives as supported by Together DevonThink and so on but cross platform Selenium IDE record edit and debug tests for Selenium the automated UI testing tool for web developers See also PHPUnit s support for Selenium You do have reproducible testing for you web apps right Stylish fix ugly sites customise the look of your browser or mail client by using your own CSS files Stylish is to CSS what Greasemonkey is to Javascript Tab Mix Plus tab management on steroids Tamper Data view and modify HTTP HTTPS headers and POST parameters TimestampDecode treats the selected number as a timestamp and displays a decoded date time TitlebarTweaks tweak Firefox s titlebar text User Agent Switcher Adds a menu and a toolbar button to switch the user agent of the browser Venkman Javascript debugger for Firefox Stu s Recommends To round off the list here are a few extensions that I find useful but which weren t recommended If you haven t heard of these before give them a try Flagfox display a country flag in the status bar for the location of the current website s server Server Switcher easily switch between development and production servers Show MyIP display your current external IP address SQLite Manager Manage any SQLIte database on your computer Are you a web developer Got a favourite Firefox extension that isn t on this list Let us know in the comments below Be the first to leave a comment Review Mastering phpMyAdmin 2 11 for Effective MySQL Management Posted by Stuart Herbert on May 6th 2008 in 1 Beginner 2 Intermediate 3 Advanced Recommendations Tagged with book review Packt Publishing phpMyAdmin The folks from Packt Publishing recently sent me another of their books to review If you re not familiar with Packt they re a relatively new book publisher who are steadily building up quite a range of technology books on open source software normally written by people involved or close to the software being written about They re like a modern day equivalent to the old O Reilly of the 90 s only imho with higher quality A Bit About Packt Mastering phpMyAdmin 2 11 for Effective MySQL Management by Marc Delisle is the third edition of this book and it follows the usual pattern of Packt Publishing books The book has clearly defined objectives on the cover and it follows a clear progression of its chosen subject from start to end It is well presented with a clear layout and clean page design that makes it easy to read The book also includes

    Original URL path: http://blog.stuartherbert.com/php/category/skill-level/advanced/ (2016-05-02)
    Open archived version from archive

  • Stuart on PHP - » Servers and Hosting
    service I want to have to build myself if I don t have to For the customers I m targeting being able to say go there sign up and deploy to their cloud and they ll look after it all for you is the right solution for everyone Where Is All The Hosting With all the buzz and hype around Node JS it seems reasonable to think that there d be plenty of cloud providers out there offering Node JS hosting services Not the here s how to install it into a VPS type stuff but a Heroku Engine Yard like service targeted at Node JS However a quick Google for nodejs hosting turned up the following results on the front page 1 hosting provider which is public free and unable to provision new services when I tried No de 3 hosting services in private beta Nodester NodeSocket and NodeJitsu and zero paid for ads offering Node JS hosting No de is the hosting service from Joyent who are the current guardians of the Node JS project itself Their Node JS product page directs you to the No de service But unfortunately No de is a limited capacity service and you can only get your app on there if you re lucky enough to catch them when there is spare capacity Joyent do offer a VPS w Node JS pre installed but you d be hard pressed to find the product if you didn t know it existed as it isn t linked to from their Node JS page at all The other three services all look interesting NodeJitsu in particular caught my eye but I can t sit down in a sales meeting today and recommend any of them to a customer because until they are public services I can t be sure that my customers can get a login and get their apps deployed and running But what really caught my eye is that no one seems to be using Google AdWords to advertise their Node JS hosting service right now That s a significant smell and a big surprise to me I don t want to draw any conclusions about that just simply ask the question does it mean that there s an opportunity that isn t being exploited yet or does it mean that the opportunity isn t big enough yet for folks to invest in Where Are The Community Meet ups As well as hosting I m also interested in being able to introduce customers to other Node JS users preferably through established developer meetup groups From the customer s perspective being part of a community helps them broaden their skills and experience and potentially helps them find new employees if they start to grow From my perspective the most valuable marketing of all is word of mouth and having customers going to meetups and saying that they re using our product because it solves their problems is a very important way of finding new

    Original URL path: http://blog.stuartherbert.com/php/category/servers-and-hosting/ (2016-05-02)
    Open archived version from archive

  • Stuart on PHP - » 1 – Beginner
    eyedropper color picker page zoomer and other colorful goodies FireBug live DOM CSS inspector The single greatest web developer add on for Firefox Live HTTP Headers view HTTP headers of a page and whilst browsing Web Developer Toolbar adds a menu and a toolbar with various web developer tools YSlow Yahoo s tool for analysing web pages and telling you why they are slow Requires Firebug Zend Studio Toolbar debugging assistance for Zend Studio 5 5 and earlier Isn t mentioned on the Zend Studio 6 pages so does that mean it is now obsolete and after that there was a lot of variety amongst the other extensions that were recommended Also Recommended Cache Status easy cache status management from the status bar ChatZilla IRC client for Firefox Duplicate Tab clone a tab along with its history Edit Cookies edit your cookies right in Firefox Fasterfox performance and network tweaks for Firefox Firefox Accessibility Extension test your web pages for functional accessibility features based on the iCITA HTML Best Practices FirePHP print to your Firebug console using a simple PHP function call FireShot take screenshots of web pages and a whole lot more Google Toolbar Google s famous in browser search toolbar GreaseMonkey customise the way a web page displays using your own Javascript add ons See also Lifehacker s Top 10 Greasemonkey User Scripts and their Better GMail and Better Flickr add ons to get an idea of just what can be done with Greasemonkey as a Firefox extension tool HTML Validator add HTML validation to your browser IE Tab Windows only open Firefox tabs using IE s rendering engine See also the popular IE View alternative LocationBar2 adds additional features to Firefox s address bar Lorem Ipsum content generator Generate Lorem Ipsum dummy text for when you need to fill a page with content for testing purposes MeasureIt draw out a ruler to get the pixel width and height of any element on the web page NagiosChecker see the status of your services and servers in Firefox s status bar You do monitor your servers right PrefBar power user toolbar for Firefox Regular Expressions Tester testing tool for regular expressions with colour highlighting RefSpoof easy spoofing of the HTTP referrer header ReloadEvery reloads a web page every so many seconds Save Session save your current browser windows tabs for the next time you open Firefox Scrapbook save web pages locally and easily manage collections Like OS X web archives as supported by Together DevonThink and so on but cross platform Selenium IDE record edit and debug tests for Selenium the automated UI testing tool for web developers See also PHPUnit s support for Selenium You do have reproducible testing for you web apps right Stylish fix ugly sites customise the look of your browser or mail client by using your own CSS files Stylish is to CSS what Greasemonkey is to Javascript Tab Mix Plus tab management on steroids Tamper Data view and modify HTTP HTTPS headers and POST parameters TimestampDecode treats the selected number as a timestamp and displays a decoded date time TitlebarTweaks tweak Firefox s titlebar text User Agent Switcher Adds a menu and a toolbar button to switch the user agent of the browser Venkman Javascript debugger for Firefox Stu s Recommends To round off the list here are a few extensions that I find useful but which weren t recommended If you haven t heard of these before give them a try Flagfox display a country flag in the status bar for the location of the current website s server Server Switcher easily switch between development and production servers Show MyIP display your current external IP address SQLite Manager Manage any SQLIte database on your computer Are you a web developer Got a favourite Firefox extension that isn t on this list Let us know in the comments below Be the first to leave a comment Review Mastering phpMyAdmin 2 11 for Effective MySQL Management Posted by Stuart Herbert on May 6th 2008 in 1 Beginner 2 Intermediate 3 Advanced Recommendations Tagged with book review Packt Publishing phpMyAdmin The folks from Packt Publishing recently sent me another of their books to review If you re not familiar with Packt they re a relatively new book publisher who are steadily building up quite a range of technology books on open source software normally written by people involved or close to the software being written about They re like a modern day equivalent to the old O Reilly of the 90 s only imho with higher quality A Bit About Packt Mastering phpMyAdmin 2 11 for Effective MySQL Management by Marc Delisle is the third edition of this book and it follows the usual pattern of Packt Publishing books The book has clearly defined objectives on the cover and it follows a clear progression of its chosen subject from start to end It is well presented with a clear layout and clean page design that makes it easy to read The book also includes a sizeable index something no decent technical book can be without I m really pleased to see that Packt are now providing example code online for download as well as online errata for the book Many of their earlier books reviewed here on Planet PHP have been criticised for not doing so it s great to see Packt improving in this area No matter which Packt book you pick up don t let the use of language be the reason you put it back on the shelf Most Packt books are written and reviewed by folks who don t speak English as their first language Once you get used to it it s never really a problem but it s worth pointing it out because if you browse their books at your local bookstore it might put you off at first Introducing phpMyAdmin If you ve never heard of it phpMyAdmin is imho one of the most important open source projects

    Original URL path: http://blog.stuartherbert.com/php/category/skill-level/beginner/ (2016-05-02)
    Open archived version from archive

  • Stuart on PHP - » #phpnw
    month before now but I hope there s still time to convince you to come along and learn how to use Git as your team grows in size That s what I m teaching a strategy plus supporting tools for Git called HubFlow that will help you stay sane and more importantly help you keep delivering as your team starts to collaborate on your product It isn t my strategy the credit must go to Vincent Driessen who first blogged about GitFlow at the start of 2010 And they aren t my tools again they originally come from Vincent All I ve done is adapt them for working against GitHub hence the name HubFlow but if BitBucket is more to your taste or wallet then rest assured that both tools and strategy work can be adapted for there too Maybe you don t need this strategy If you re working on one off consulting gigs for clients where you can get in quick and get out quick then HubFlow might not be necessary But if you re working on any sort of product or service either commercially or open source then I can strongly recommend HubFlow to you even if you re just at the one man startup stage And the benefits of adopting HubFlow only increase as your team grows in size I ve already put a lot of effort into documenting HubFlow and if you ve previously read the docs you might be feeling confident enough to adopt it by yourself If you do I think that s awesome and you should go for it without delay Please do email me if I can help in any way I m passionate about everyone adopting the fundamentals of software engineering and few things are more fundamental than good source control But if you re still reading at this point I hope that I can convince you to buy one of the remaining tickets for my tutorial session at phpnw12 I don t personally profit by it all of us teaching at phpnw12 are volunteers but maybe you will What I m teaching is the approach that I ve introduced to DataSift You might not have heard of us yet we provide a platform for filtering social data in real time handling terabytes of data a day at full firehose scale and many thousands of incoming data every second And every piece of that data goes through code written in PHP Although we re a young startup we ve already grown beyond 20 developers and with that many people collaborating to build that platform with every team working at their own pace we needed to adopt a common way of working together with Git and GitHub so that the company continued to scale well It had to be a way that allowed every developer to take full advantage of Git especially when it comes to committing their work early and often It had to allow developers to form ad hoc teams that worked at their own pace Remote working is a fact of life these days and it had to work just as well whether everyone is in the office or working from somewhere else It also had to ensure that only work that had been finished made its way into any of our releases We wanted to make sure that there was an opportunity to review every change before it went into a release Code reviews play an important part in delivering high quality work time after time after time We didn t want pending releases to hold up new development ever And if something did screw up in production we needed a way to go back to our last known good version fix it and release that all without disrupting any pending releases or existing ad hoc teams Finally it had to be easy to teach to people who are new to Git and GitHub preferably by wrapping complicated Git operations up inside a single command each time Those are the benefits that HubFlow gives us And at phpnw12 I ll be teaching everyone who attends my tutorial session how to get those benefits too What makes me qualified to teach this topic And what makes me qualified to be teaching at all I ve got 18 years of experience setting up and or running software configuration management taking in systems as diverse as RCS CVS Perforce Continuus Clearcase Subversion Mercurial and Git I ve done this with and for organisations as small as a one man team all the way through to large international corporates I ve even built a version control system for one company in the past Git is much better And I was around long enough to see and learn from the failures as well as the successes I m a big believer that success teaches you a bit but failure teaches you more Plus I m the author of the HubFlow strategy and the maintainer of the HubFlow extension for Git It simply isn t possible for me to distill all of that rich and lengthy experience down into the documentation that I ve written for HubFlow I think the documentation is good I wouldn t have put my name to it otherwise but I think you can learn even more from me in person I m a qualified teacher of adults I m trained how to teach and I ve had a lot of practice doing so My first PHP conference appearance was back in 2004 on Marco s php cruise and since then I ve spoken at the PHP NorthWest and PHP UK conferences several times I co wrote the Zend Certification Study Guide for PHP4 Once a year I teach at the University of Aberystwyth helping their Comp Sci students prepare for applying for jobs for their year in industry Plus I ve done a substantial amount of teaching and mentoring as part of my job and open source work

    Original URL path: http://blog.stuartherbert.com/php/category/community/phpnw/ (2016-05-02)
    Open archived version from archive

  • Stuart on PHP - » 2 – Intermediate
    PEAR packages onto your system Double click the PEAR ENV reg file in c php Reboot again to make sure PEAR ENV registry entries have taken effect At this point PEAR is installed and should be available to use in your own projects or with something like Phix Personal Notes Some reminders to myself for the next time I have to do this Documentation for PHP for Windows and PEAR for Windows both seem to be out of step with current downloads There s currently no Windows installer for PHP available and the PHP ZIP file doesn t contain the go pear bat file You have to pay close attention to the default folders offered when running go pear phar They appear to use the current working directory as the prefix even when installing system wide except for the location of pear ini and php exe neither of these defaults are sane and must be manually changed during the install After install pear command doesn t seem to be 100 compatible with its behaviour on Linux and OS X D switch didn t work there may be other problems too that I haven t yet found Both reboots are required I m not taking the piss there for all running Windows apps to pick up the changes 19 comments Comparing ContractLib to PHP s Built In assert Posted by Stuart Herbert on January 17th 2012 in 2 Intermediate phix Toolbox One of the questions I ve been asked after yesterday s blog post about Phix s ContractLib is why not just use PHP s built in assert function I think it s a great question and the best way to answer it is to take a look at the key differences between two solutions Side By Side Comparison Feature assert ContractLib Implementation PHP extension written in C ships as standard part of PHP PHP library written in PHP Enable disable execution Partial there is an overhead when disabled but it s low Partial there is an overhead when disabled but it s higher Issues PHP4 style warning when tests fail Yes configurable No throws a ContractFailedException instead Terminate PHP script when tests fail Yes configurable Only if the ContractFailedException is never caught Quiet eval of test expression Yes configurable No not required test expressions are pure PHP code not eval strings Callback on failed test Yes configurable No unwinds the stack instead by throwing ContractFailedException Throws Exception when tests fail No but can emulate if you write your own assert callback method Yes standard behaviour Tests are pure PHP code No recommended way is to pass strings into assert to be eval d Yes Error report includes original value that failed the test No Yes Support for per test custom failure messages No Yes are required to provide one Support for Old Value storage and recall No but can emulate by hand Yes The Differences Explained The key difference is one of philosophy assert sits well with the PHP4 style of error reporting and handling whereas ContractLib is firmly in favour of the OO world s approach to reporting errors It s a personal preference but I think that PHP4 style errors have no place in code that has any desire to be robust Exceptions aren t perfect don t get me wrong but their core property of unwinding the call stack in an orderly fashion makes writing robust code much easier And they also carry a payload information about what went wrong and why which PHP s assert cannot provide to the same extent It s much quicker to debug something when there s a record of the value that failed the test For that reason alone I d always prefer something like ContractLib over the built in assert approach But we can t ignore the fact that these are tests that get shipped to and executed in the production environment Unlike unit tests adopting programming by contract will slow down your PHP code in production The question is by how much What About The Performance I ve done some benchmarking between the two using the five tests listed in the final example in yesterday s blog post It s a real world example of the kind of tests that I would look to add to code to improve robustness Here are the results I gathered calling the tests 10 000 times in a tight loop The tests were run from the command line and the times do include PHP start up shutdown time and the time taken to parse each test file I assumed a best case scenario where the tests would always pass Test Approach Time w Tests Disabled Time w Tests Enabled Tests written using assert 1 103s 100 5 989s 543 Tests written using ContractLib 3 055s 277 3 096s 281 When tests are disabled using assert is much cheaper than using ContractLib today That s to be expected as assert is written in C I imagine that we could get close to the same performance if ContractLib was rewritten in C as a PHP extension But when tests are enabled assert is much slower than ContractLib Why Because the recommended way to use assert is to pass the test in as a string PHP has to convert that string into bytecode to execute and that conversion appears to be quite expensive Given the choice I d rather trade things running a little slower in production for having much faster tests when I m writing code and that s why I created ContractLib Plus I get much better information to understand why the test failed and if I wanted to run the tests in production I can handle their failures in a much saner way Final Words In my experience the time it takes to develop and ship code is normally more critical than how fast the code runs in production Developer time has become a scarcer resource than CPU time Used intelligently these kinds of tests in your code can help your team deliver quicker because the code they are using and reusing is more robust first time around Programming by contract is different to and complements unit testing because contract tests catch errors in using the code Whether you use ContractLib assert or you create your own solution you should really consider how much it is costing you when you don t use these kinds of tests Be the first to leave a comment Getting Started With ContractLib Posted by Stuart Herbert on January 16th 2012 in 2 Intermediate Examples phix In my last blog post I introduced ContractLib a simple programming by contract library that I ve created for PHP 5 3 onwards And I promised some examples Installing ContractLib ContractLib is available from the Phix project s PEAR channel Installing it is as easy as code lang bash pear channel discover pear phix project org pear install a phix ContractLib code At the time of writing this will install ContractLib 2 1 0 We use semantic versioning so these examples will continue to work with all future releases of ContractLib 2 x Adding ContractLib To Your Project Assuming you re using a PSR 0 compatible autoloader just import the Contract class into your PHP file sourcecode language php use Phix ProjectContractLibContract sourcecode Adding A Pre condition Contract To Your Method Or Function Take a trivial method like this code lang php class ActionToApply public function appendNow params params time code This method works fine until someone passes a non array as the parameter At that point your code stops working not because your code is wrong but because someone used it in the wrong way This is a classic cause of buggy PHP apps Thankfully it s very easy to address using ContractLib If we were certain that the params parameter was always an array then we can keep the method itself extremely simple and clean We can ensure that by adding a pre condition using ContractLib code lang php use Phix ProjectContractLibContract class ActionToApply public function appendNow params Contract Preconditions function use params Contract RequiresValue params is array params params must be an array original method code continues here params time code Now if someone passes in a non array the caller will automatically get an E5xx ContractFailedException which makes it clear that the fault is in the caller s code not your s PHP 5 4 s upcoming support for better type hinting is another way to catch this kind of error but not only does ContractLib work today with PHP 5 3 which means you don t have to wait to migrate to PHP 5 4 but also that you can write tests for anything not just the checking that s built into PHP This means you can make your code much more robust by tightening up on the quality of the parameter passed into your code by other programmers To extend our example we might decide that an empty array is also unacceptable code lang php use Phix ProjectContractLibContract class ActionToApply public function appendNow params Contract Preconditions function use params Contract RequiresValue params is array params params must be an array Contract RequiresValue params count params 0 params cannot be an empty array original method code continues here params time code The point here is that we can go way beyond type hinting checks important as they are and look inside parameters to make sure they are suitable Here s a real example from Phix s CommandLineLib code lang php use Phix ProjectContractLibContract class CommandLineParser public function parseSwitches args argIndex DefinedSwitches expectedOptions catch programming errors Contract Preconditions function use args argIndex expectedOptions Contract RequiresValue args is array args args must be array Contract RequiresValue args count args 0 args cannot be an empty array Contract RequiresValue argIndex is integer argIndex argIndex must be an integer Contract RequiresValue argIndex count args argIndex argIndex cannot be more than 1 beyond the end of args Contract RequiresValue expectedOptions count expectedOptions getSwitches 0 expectedOptions must have some switches defined method s code follows on here code In this real life code we start off by checking for basic errors first by making sure we re looking at the right type for each parameter and then we follow up with more specific tests that ensure that we have data that we re happy to work with We ve done these tests at the start of the method so that it isn t cluttered with error checking which makes our code much cleaner that it might otherwise be And because all the tests are in one really easy to spot block anyone reading your code can immediately see what they have to do to meet the contract you ve created Because these tests are just plain old PHP code and don t rely on annotations or any other such nonsense the contracts you create and enforce are limited only by your choices But Aren t All Those Tests Slow They are PHP s getting better and better at this but function method calls have always been painfully slow in PHP I m afraid that if you want robust code you can t have it for free You can in C but that s a topic to discuss over a decent whiskey at a conference I ve done key two things with ContractLib to keep the runtime cost down Contract Preconditions accepts a lambda function as its parameter Your contract s tests go inside this lambda function and Contract Preconditions only calls the lambda function if contracts are enabled By default ContractLib does not enable contracts You have to choose to do so by calling Contract EnforceWrappedContracts This keeps the overhead down to just one method call to Contract Preconditions when contracts are not enabled It isn t as good as having no overhead but it s cheaper than the developer time lost trying to track down bugs in code that always assumes the caller can be trusted to do the right thing every time Any Questions I hope these examples have given you an idea on how to get started with ContractLib If you have any questions or suggestions please let me know and I ll do my best to answer them Be the first to leave a comment Introducing ContractLib Posted by Stuart Herbert on January 11th 2012 in 2 Intermediate ContractLib is a simple to use PHP component for easily enforcing programming contracts throughout your PHP components These programming contracts can go a long way to helping you and the users of your components develop more robust code ContractLib is loosely inspired by Microsoft Research s work on the Code Contracts Library for NET What Are Programming Contracts Programming contracts are tests around functions and methods and they are normally used to catch any bad data that has been passed into the function or method from the caller and to catch any bad data generated by the function or method before it can be returned to the caller These are pre condition and post condition tests and they are tests that either pass or fail Why Have Programming Contracts Two reasons code robustness and time saved Programming contracts catch errors early and unlike unit tests they don t just catch your errors they catch errors made by programmers who reuse your code Catching errors early There is a class of bugs best described as garbage in garbage out The garbage in is data that is of the wrong type or out of range or missing think empty arrays empty strings nulls Often the garbage being fed in is also garbage that has come out of a buggy function or method Simple pre condition checks at the start of your functions and methods quickly catches garbage data before it can propagate through your code The more functions and methods contain pre condition checks the easier it becomes to catch garbage data closer to where it is being created This allows you to spend less time tracking down the original source of a bug and more time writing new code These pre conditions also greatly increase the chances of bugs in your code being caught in development especially when combined with a healthy amount of unit testing You can also add post conditions at the end of your functions and methods to make sure that you re never returning any garbage back out of your function or method There s a lot of overlap between post conditions and unit tests the main difference is that your post conditions will run 100 of the time whereas your unit tests will only run when you run them and against the often extremely limited data you use in your unit tests Catching errors when code is reused Unit tests are great and a very important part of creating high quality code But they re your tests They re written to prove that your code does what you think it does Unit tests don t prove that someone else is reusing your code the way you meant them to And neither do integration tests because if someone is reusing your code integration tests are their tests Integration tests are tests to prove that they have glued their code on top of your code in a way that they are happy with Simple pre condition checks at the start of your functions and methods are your best opportunity to test how someone else is reusing your code and to tell them if they re getting it wrong Programming contracts are about building trust just like unit tests Code that you can trust is normally code that is quicker to work with They re really quick to write normally far quicker than unit tests and they can make it really quick to track down the origin of bugs in your code Don t Programming Contracts Make Code Stupidly Strict An appropriate amount of strictness is a requirement of all high quality code The trick is knowing what to be strict about Not strict enough and you let in shitty data that causes your code to fail or be insecure Too strict and people will think that your code is too much trouble to work with As a general rule pre conditions should check for data that s in an incorrect format data that s out of range data that s missing Post conditions should check the same things They can also be used to check for data that should have been changed but hasn t been changed Aren t Programming Contracts Too Old Fashioned For PHP The concept has been around for decades As a C programmer I first learned about programming contracts in the early 90 s when I was writing code that had to run for months at a time with zero downtime We were debugging and improving code dating back from the 1980 s and introducing programming contracts played an important role in getting to the bottom of many of the bugs that users reported PHP code and other modern languages like Java Ruby Scala etc is fundamentally similar to older languages like C although you may not realise that this is the case It s the same fundamental paradigm data is passed into blocks of software and blocks of software may also pass data out too The advantage we have with PHP is that our programming contracts don t have to be as lengthy as they would for a C program because PHP itself can enforce type checks through type hinting and we don t have to worry about low level details like proper handling of null terminated strings Examples You can take a look at ContractLib s unit tests on GitHub I ll post some detailed examples in my next blog post Be the first to leave a comment Real Time Graphing With Graphite Posted by Stuart Herbert on September 21st 2011 in 2

    Original URL path: http://blog.stuartherbert.com/php/category/skill-level/intermediate/ (2016-05-02)
    Open archived version from archive

  • Stuart on PHP - » phix
    a phix php library removeunusedroles command if you want to strip unused roles from an existing component phpunit xml dist support components now use phpunit xml dist by default so that you can put your own phpunit xml in place if you ever need to override the default settings src README md we now drop a hopefully helpful README file inside the src folder to explain what goes where misc robustness improvements to build xml files I ve made some small tweaks to the build xml file to try and catch a few error conditions and display helpful messages internal debugging phix d which has been documented for several release now enables internal debugging tests inside Phix and its components It s mostly there for me to use but I thought I d mention it in case you re testing a patch for phix before sending it to me A big thanks to everyone who attended my workshop at PHPNW11 in October for their feedback and feature requests for this release How To Install To install Phix we have handy one line install scripts on the Phix project homepage And I ve put together a screencast of how to install Phix on Ubuntu It s my first ever screencast so please be gentle How To Upgrade To upgrade from an earlier release of Phix please do the following sudo pear clear cache sudo pear upgrade phix phix4componentdev Once you ve upgraded phix itself don t forget to go into each of your components and run phix php library upgrade to upgrade all of the skeleton files build xml et al for your component What s Coming In Phix 0 16 Windows support hasn t happened yet but I hopefully have a volunteer who is going to look into that during February My priority for phix 0 16 is to make it easy to build phix based components in Jenkins based on Sebastian s Jenkins Template I m doing this next because I m not sure how much I ve got to change things to suit Jenkins so I d rather get it done sooner so it s done and out of the way And I promise that I haven t forgotten docblox support either Our roadmap has all the details Be the first to leave a comment Comparing ContractLib to PHP s Built In assert Posted by Stuart Herbert on January 17th 2012 in 2 Intermediate phix Toolbox One of the questions I ve been asked after yesterday s blog post about Phix s ContractLib is why not just use PHP s built in assert function I think it s a great question and the best way to answer it is to take a look at the key differences between two solutions Side By Side Comparison Feature assert ContractLib Implementation PHP extension written in C ships as standard part of PHP PHP library written in PHP Enable disable execution Partial there is an overhead when disabled but it s low Partial there is an overhead when disabled but it s higher Issues PHP4 style warning when tests fail Yes configurable No throws a ContractFailedException instead Terminate PHP script when tests fail Yes configurable Only if the ContractFailedException is never caught Quiet eval of test expression Yes configurable No not required test expressions are pure PHP code not eval strings Callback on failed test Yes configurable No unwinds the stack instead by throwing ContractFailedException Throws Exception when tests fail No but can emulate if you write your own assert callback method Yes standard behaviour Tests are pure PHP code No recommended way is to pass strings into assert to be eval d Yes Error report includes original value that failed the test No Yes Support for per test custom failure messages No Yes are required to provide one Support for Old Value storage and recall No but can emulate by hand Yes The Differences Explained The key difference is one of philosophy assert sits well with the PHP4 style of error reporting and handling whereas ContractLib is firmly in favour of the OO world s approach to reporting errors It s a personal preference but I think that PHP4 style errors have no place in code that has any desire to be robust Exceptions aren t perfect don t get me wrong but their core property of unwinding the call stack in an orderly fashion makes writing robust code much easier And they also carry a payload information about what went wrong and why which PHP s assert cannot provide to the same extent It s much quicker to debug something when there s a record of the value that failed the test For that reason alone I d always prefer something like ContractLib over the built in assert approach But we can t ignore the fact that these are tests that get shipped to and executed in the production environment Unlike unit tests adopting programming by contract will slow down your PHP code in production The question is by how much What About The Performance I ve done some benchmarking between the two using the five tests listed in the final example in yesterday s blog post It s a real world example of the kind of tests that I would look to add to code to improve robustness Here are the results I gathered calling the tests 10 000 times in a tight loop The tests were run from the command line and the times do include PHP start up shutdown time and the time taken to parse each test file I assumed a best case scenario where the tests would always pass Test Approach Time w Tests Disabled Time w Tests Enabled Tests written using assert 1 103s 100 5 989s 543 Tests written using ContractLib 3 055s 277 3 096s 281 When tests are disabled using assert is much cheaper than using ContractLib today That s to be expected as assert is written in C I imagine that we could get close to the same performance if ContractLib was rewritten in C as a PHP extension But when tests are enabled assert is much slower than ContractLib Why Because the recommended way to use assert is to pass the test in as a string PHP has to convert that string into bytecode to execute and that conversion appears to be quite expensive Given the choice I d rather trade things running a little slower in production for having much faster tests when I m writing code and that s why I created ContractLib Plus I get much better information to understand why the test failed and if I wanted to run the tests in production I can handle their failures in a much saner way Final Words In my experience the time it takes to develop and ship code is normally more critical than how fast the code runs in production Developer time has become a scarcer resource than CPU time Used intelligently these kinds of tests in your code can help your team deliver quicker because the code they are using and reusing is more robust first time around Programming by contract is different to and complements unit testing because contract tests catch errors in using the code Whether you use ContractLib assert or you create your own solution you should really consider how much it is costing you when you don t use these kinds of tests Be the first to leave a comment Getting Started With ContractLib Posted by Stuart Herbert on January 16th 2012 in 2 Intermediate Examples phix In my last blog post I introduced ContractLib a simple programming by contract library that I ve created for PHP 5 3 onwards And I promised some examples Installing ContractLib ContractLib is available from the Phix project s PEAR channel Installing it is as easy as code lang bash pear channel discover pear phix project org pear install a phix ContractLib code At the time of writing this will install ContractLib 2 1 0 We use semantic versioning so these examples will continue to work with all future releases of ContractLib 2 x Adding ContractLib To Your Project Assuming you re using a PSR 0 compatible autoloader just import the Contract class into your PHP file sourcecode language php use Phix ProjectContractLibContract sourcecode Adding A Pre condition Contract To Your Method Or Function Take a trivial method like this code lang php class ActionToApply public function appendNow params params time code This method works fine until someone passes a non array as the parameter At that point your code stops working not because your code is wrong but because someone used it in the wrong way This is a classic cause of buggy PHP apps Thankfully it s very easy to address using ContractLib If we were certain that the params parameter was always an array then we can keep the method itself extremely simple and clean We can ensure that by adding a pre condition using ContractLib code lang php use Phix ProjectContractLibContract class ActionToApply public function appendNow params Contract Preconditions function use params Contract RequiresValue params is array params params must be an array original method code continues here params time code Now if someone passes in a non array the caller will automatically get an E5xx ContractFailedException which makes it clear that the fault is in the caller s code not your s PHP 5 4 s upcoming support for better type hinting is another way to catch this kind of error but not only does ContractLib work today with PHP 5 3 which means you don t have to wait to migrate to PHP 5 4 but also that you can write tests for anything not just the checking that s built into PHP This means you can make your code much more robust by tightening up on the quality of the parameter passed into your code by other programmers To extend our example we might decide that an empty array is also unacceptable code lang php use Phix ProjectContractLibContract class ActionToApply public function appendNow params Contract Preconditions function use params Contract RequiresValue params is array params params must be an array Contract RequiresValue params count params 0 params cannot be an empty array original method code continues here params time code The point here is that we can go way beyond type hinting checks important as they are and look inside parameters to make sure they are suitable Here s a real example from Phix s CommandLineLib code lang php use Phix ProjectContractLibContract class CommandLineParser public function parseSwitches args argIndex DefinedSwitches expectedOptions catch programming errors Contract Preconditions function use args argIndex expectedOptions Contract RequiresValue args is array args args must be array Contract RequiresValue args count args 0 args cannot be an empty array Contract RequiresValue argIndex is integer argIndex argIndex must be an integer Contract RequiresValue argIndex count args argIndex argIndex cannot be more than 1 beyond the end of args Contract RequiresValue expectedOptions count expectedOptions getSwitches 0 expectedOptions must have some switches defined method s code follows on here code In this real life code we start off by checking for basic errors first by making sure we re looking at the right type for each parameter and then we follow up with more specific tests that ensure that we have data that we re happy to work with We ve done these tests at the start of the method so that it isn t cluttered with error checking which makes our code much cleaner that it might otherwise be And because all the tests are in one really easy to spot block anyone reading your code can immediately see what they have to do to meet the contract you ve created Because these tests are just plain old PHP code and don t rely on annotations or any other such nonsense the contracts you create and enforce are limited only by your choices But Aren t All Those Tests Slow They are PHP s getting better and better at this but function method calls have always been painfully slow in PHP I m afraid that if you want robust code you can t have it for free You can in C but that s a topic to discuss over a decent whiskey at a conference I ve done key two things with ContractLib to keep the runtime cost down Contract Preconditions accepts a lambda function as its parameter Your contract s tests go inside this lambda function and Contract Preconditions only calls the lambda function if contracts are enabled By default ContractLib does not enable contracts You have to choose to do so by calling Contract EnforceWrappedContracts This keeps the overhead down to just one method call to Contract Preconditions when contracts are not enabled It isn t as good as having no overhead but it s cheaper than the developer time lost trying to track down bugs in code that always assumes the caller can be trusted to do the right thing every time Any Questions I hope these examples have given you an idea on how to get started with ContractLib If you have any questions or suggestions please let me know and I ll do my best to answer them Be the first to leave a comment Phix 0 14 Released Posted by Stuart Herbert on October 24th 2011 in phix Phix v0 14 is now available from pear phix project org What s New In This Release Snapshot versions of components not ready to release a stable version of your component but still need to publish your component to your PEAR channel for testing You can now set the project snapshot property in your build properties file and get non stable packages for distribution Code coverage improvements when you run phing test to run your component s unit tests and generate the code coverage report the code coverage report now automatically picks up all of your component s PHP code regardless of whether there is a test for it or not phpunit xml support phix now puts a phpunit xml file inside your component which includes all of the settings required to execute your component s unit tests This should help TextMate users a lot This change was requested by attendees at the PHPNW11 conference More hooks in build local xml for every target in your component s build xml file you can now add local target in build local xml to perform any additional steps that you want to do This feature was contributed by Martin Wernståhl Usability improvements your component s build xml file now traps more errors than before hopefully making it even easier to learn how to work with components How To Upgrade To upgrade from an earlier release of Phix please do the following sudo pear clear cache sudo pear upgrade phix phix4componentdev Once you ve upgraded phix itself don t forget to go into each of your components and run phix php library upgrade to upgrade all of the skeleton files build xml et al for your component What s Coming In Phix 0 15 Phix 0 15 is all about making sure that Phix works as well on Windows as it already does on Linux and OSX The feedback from the ZendCon session which I was gutted to be unable to attend was that there isn t much needed mostly setup instructions Once that is done we ll continue to support Phix on Windows just as we already do on Linux and OSX Our roadmap for Phix 0 15 has all the details Be the first to leave a comment PHP Components Installing Phix on CentOS Posted by Stuart Herbert on October 3rd 2011 in phix Toolbox In my Beyond Frameworks talk I explained how a component based architecture can help answer some of the important i e expensive questions you might face when creating long lived apps that rely on a PHP framework In this series of blog posts I m going to look at how to go about creating and working with components We ve created a development tool called phix to make it as easy as possible to create and maintain your own components written in PHP Phix is normally installed onto a development desktop or laptop you would normally only need to install Phix on a server running CentOS if the server is a shared development server or a continuous integration server running something like Jenkins Follow these easy instructions to get phix installed on CentOS Using The One Line Installer The easiest way to get phix installed onto your CentOS server is to run the following command from a Terminal window curl O http phix project org installers centos 6 sh su c bash centos 6 sh This command downloads a simple shell script which you can find on GitHub if you want to read it before trying it which is then run as the user root The shell script Makes sure that you have a suitable version of PHP installed Uses apt get to install required dependencies Uses the pecl command to install PHP extensions that we can t get packaged for CentOS Upgrades the PEAR installer to the latest version Installs the package phix phix4componentdev plus dependencies from the PEAR channel pear phix project org If all goes well once everything has finished run the following command and you ll see that phix is now installed pear list c phix grep phix phix 0 13 2 stable phix4componentdev 0 13 2 stable Where To Find The Latest Installation Instructions You can always find the latest installation instructions for phix on the Phix project s website including full instructions on how to do a manual install if you have trouble with our one line installer Be the first to leave a comment PHP Components Installing Phix On Debian Posted by Stuart Herbert on October 3rd 2011 in phix Toolbox

    Original URL path: http://blog.stuartherbert.com/php/category/phix/ (2016-05-02)
    Open archived version from archive



  •