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 - » Storyplayer 1.5 Released
    the open source test automation tool built by DataSift Use it to bring your user stories to life using plain old PHP noDSL Create test environments deploy code test with real browsers shell commands and any PHP code and clean up afterwards all from your tests Write your tests once and run them against your dev test staging and production environments Storyplayer ships with 20 modules including support for Vagrant Amazon EC2 and ZeroMQ and can easily be extended with your own plugins 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 Add Your Comments To This Article Using The Form Below Your name required Your email address will not be published required Your website Your comment Your comments may not appear until they have been approved by a moderator Latest Photos Categories phpnw 1 Beginner 2 Intermediate 3 Advanced Brighton PHP Conferences Opinion phix PHP In Business PSR Servers and Hosting Storyplayer Talks Toolbox Training Uncategorized Archives February 2016 January 2016 November 2015 October 2015 August 2015 March 2015 January 2014 May 2013 April 2013 March 2013 December 2012 November 2012 October 2012 September 2012 August 2012 July 2012 June 2012 May 2012 February 2012 January 2012 October 2011 September 2011 August 2011 July 2011 April 2011 March 2011 February 2011 October 2010 August 2010 July 2010 February 2010 January 2010 October

    Original URL path: http://blog.stuartherbert.com/php/2014/01/07/storyplayer-1-5-released/ (2016-05-02)
    Open archived version from archive

  • Stuart on PHP - » Storyplayer
    plain old PHP noDSL Create test environments deploy code test with real browsers shell commands and any PHP code and clean up afterwards all from your tests Write your tests once and run them against your dev test staging and production environments Storyplayer ships with 20 modules including support for Vagrant Amazon EC2 and ZeroMQ and can easily be extended with your own plugins Be the first to leave a comment Storyplayer Slides From PHP London Talk Posted by Stuart Herbert on May 31st 2013 in Storyplayer Storyplayer is DataSift s test tool for functional and non functional testing of software and services built to test at the firehose scale It sits nicely between PHPUnit for unit testing by developers and Behat for acceptance testing by product managers Earlier this month I spoke to a packed audience at the PHP London user group meetup about Storyplayer a test tool that we ve open sourced here at DataSift Here are the slides from that talk for everyone who hasn t yet seen them via Twitter If you can t see the embedded slides in this blog post they re available over on SlideShare Right now I m focused on completing the online documentation which is very much a work in progress and preparing v1 1 0 with further improvements Comments Off on Storyplayer Slides From PHP London Talk Latest Photos Categories phpnw 1 Beginner 2 Intermediate 3 Advanced Brighton PHP Conferences Opinion phix PHP In Business PSR Servers and Hosting Storyplayer Talks Toolbox Training Uncategorized Archives February 2016 January 2016 November 2015 October 2015 August 2015 March 2015 January 2014 May 2013 April 2013 March 2013 December 2012 November 2012 October 2012 September 2012 August 2012 July 2012 June 2012 May 2012 February 2012 January 2012 October 2011 September 2011 August

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

  • Stuart on PHP -
    and above Unfortunately because it was difficult to crowbar this into Monolog the decision was taken to go with strings for the log level constants This regrettably increases the complexity of all other loggers If you look at pull request to add PSR 3 to Monolog you ll notice that Monolog is explicitly relying on the value of the PSR 3 constants to map them directly onto Monolog class constants 375 public function log level message array context array 376 377 if is string level defined CLASS strtoupper level 378 level constant CLASS strtoupper level 379 380 381 return this addRecord level message context 382 This is done because ironically Monolog already uses numerical log levels internally with the debug level having a value of 100 and the emergency level having the value of 600 There was obviously the risk of Monolog log level constants being passed in instead of the PSR 3 constants where it would have been impossible to tell them apart if they were both numeric I m sure other existing loggers probably face similar issues It s a tricky issue but on balance I think the wrong decision was made here for the wrong reason and the community would have been better served longer term if PSR 3 had supported the RFC 5424 values for the log level constants Final Thoughts PSR 3 isn t objectionable it s just that it could have been a bit better than it is I ve added both PSR 3 support and the revised methods from this blog post to my internal LogLib PSR 3 will allow me to inject LogLib into third party components that support it My own code will be using the revised methods I ve proposed here for the reasons mentioned above Comments Off on Personal Thoughts On The PSR 3 Log Proposal Free Ebook Getting Hired Posted by Stuart Herbert on November 12th 2012 in 1 Beginner Toolbox Training From the Introduction This e book will hopefully show you how to put yourself across to a prospective employer in a way that makes it easy for them to spot what you have to offer them to increases your chances of successfully finding a job in the United Kingdom s computing industry Recruitment processes vary from employer to employer I ll take you through the most likely steps that you need to get through I ll explain the process from the employer s perspective first and then from your point of view as someone applying for a job A better understanding of what the recruitment process is and why will help you avoid the common pitfalls along the way The second part of the book is more about you about what you need to do to be prepared for when you join the industry either during an industrial placement year or when you graduate and leave academia Ours is a multi disciplined industry where things change rapidly so to help you prepare I ve finished off the book with some lists of the fundamental skills that industry expects you to have before you start your first job Getting Hired is a free ebook released under a Creative Commons licence I hope you find it useful 2 comments PHP NorthWest 2012 Another Great Year Posted by Stuart Herbert on October 8th 2012 in phpnw Conferences Last weekend saw the PHP NorthWest user group run their fifth conference Spread over three days it gave over 400 folks who attended great talks on a wide variety of topics from speakers both established and new Once again Jeremy Rick et al ran an excellent conference and I m already looking forward to next year s event See more of my photos from the PHPNW12 conference on Flickr Be the first to leave a comment Released HubFlow v1 4 A Git Extension Posted by Stuart Herbert on October 3rd 2012 in Toolbox I ve just published v1 4 of DataSift s HubFlow Git extension HubFlow is a branching strategy for Git and GitHub based on Vincent Driessen s original GitFlow model Changes In This Release The main change in this release is that you now must merge your feature into the develop branch via a pull request before using the git hf feature finish command You can override this behaviour and get feature finish to do the merge for you by using the f flag The full changelog is available on our GitHub pages Upgrading From An Older Release To upgrade to this release please run sudo git hf upgrade If that doesn t work because you re on an older version of HubFlow that doesn t have the upgrade command please re install git clone https github com datasift gitflow cd gitflow sudo install sh Be the first to leave a comment Using Git Collaboratively My Tutorial At PHPNW12 Posted by Stuart Herbert on September 13th 2012 in phpnw 2 Intermediate Conferences Training I haven t really talked much about my upcoming tutorial session at phpnw12 next 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

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

  • Stuart on PHP -
    you should be able to open up a Command Prompt and type php v and see the response PHP v5 4 latest appear as expected Now for PEAR itself Open http pear php net go pear phar in a browser save this file into c php In a Command Prompt cd to c php and then run php c phpgo pear phar At the prompt select system A text menu of paths will appear Fix the default path for pear ini option 11 to be c phppear ini Fix the default folder to look inside for php exe to be c php Make sure the binaries folder option 4 is c php Check all of the other options make sure they are prefixed with c php Press ENTER and you should see PEAR downloading various 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 Setting Up Sublime Text 2 For PHP Development Posted by Stuart Herbert on February 28th 2012 in Opinion Toolbox Wow Last week s opinion piece about switching from Netbeans to Sublime Text 2 has been the most popular blog post I ve written for quite a while As the interest seems to be there I thought it would be a great idea to follow up with a post taking you step by step through how I ve set up Sublime Text 2 for PHP development and showing you some of the useful features that you get out of the box with Sublime Text 2 You ll find the details below and as a bit of an experiment I ve also put the details together in a series of YouTube videos for those folks who d prefer to see ST2 in action The video directly below is the first in the playlist and I ve also put the video for each feature separately further down If you like the videos please do click the Like button on YouTube so that I know Tip If you can t see any YouTube videos on this page you might need to switch off your browser s AdBlock plugin and then reload the page Install Package Control Soda And A Syntax Highlighting Scheme Out of the box Sublime Text 2 is a very good text editor It s so good in fact that I ve seen people use it in its vanilla form perfectly happily for days and weeks before realising that it can be enhanced with third party plugins The first plugin I recommend installing is Will Bond s Package Control installation instructions Package Control is a plugin that automates the job of installing and upgrading plugins After you ve installed it restart ST2 and then you ll find a new Package Control menu option at the bottom of the Preferences menu There are over 200 community plugins currently available for ST2 You ll find them by going into Package Control and selecting the Discover Packages option This takes you to the community packages webpage where you can browse or search through the available packages It s worth going back and checking this page from time to time as new packages are being added on a regular basis The next thing I normally do is reskin ST2 This is entirely a personal preference Using Package Control install the Soda Theme plugin this downloads the plugin but does not activate it Then open up the Settings User preferences file this is a JSON file and add the following to tell ST2 to use the new theme theme Soda Dark sublime theme You ll notice a change straight away but will probably need to restart ST2 for it to pick up all of the new theme properly Finally I setup syntax highlighting to suit ST2 ships with a number of these and you can if you wish feed it any colour scheme originally created for TextMate I prefer to use the Phix Color Scheme which is available through Package Control Editing User Preferences In ST2 nearly all of the configuration is done by creating and editing config files There are no user interfaces to click through just JSON files to edit by hand There are a few of these files and the basic idea is that there s nearly always a default config file which contains the defaults that ST2 or its plugins ship with and user override files If you go into the Preferences menu you ll see a Settings Default option This opens the default settings file that ST2 ships with It s very well documented and well worth a browse through to see if there s anything in there that you d like to tweak Don t make changes to this file instead open the Settings User option on the Preferences menu and put your changes in there That way your preferences will be preserved between ST2 upgrades Finding Classes With The Goto Anything Pane There are two ways you can open files in ST2 One way is to navigate through your list of folders in the Project pane on the left hand side of the screen clicking around with the mouse and drilling down to find the file that you re looking for It works but there s a faster alternative Hitting CTRL P CMD P on the Mac opens up the Goto Anything pane Here you can type in the name of the file that you re looking for and in real time you ll see a list of matches appear The searching supports fuzzy matching you can type in partial search strings and ST2 will use them to filter out This is a godsend for working with projects that include vendor folders which you might not want to search inside and any Subversion checkouts that include trunk branches and tags Jump To A Line Using The Goto Anything Pane Press CTRL G CMD G on the Mac and this brings up the Goto Anything pane ready for you to type in a line number As you type ST2 goes to the line number starting to form in the input box You can also do exactly the same by pressing CTRL P and typing a colon at the start of the search CTRL G simply opens the Goto Anything pane and puts the colon there for you as a shortcut You can also combine this with the file search Hit CTRL P and start searching for a file Then at the end of your search add a colon and then the line number that you re looking for This will take you to that line number in that file all from the keyboard Goto A Defined Symbol Using The Goto Anything Pane Press CTRL R CMD R on the Mac and this brings up the Goto Anything pane ready for you to type in the name of a function or method As you type ST2 narrows down the list of matching functions methods and classes in your file You can do the same by pressing CTRL P and typing an symbol at the start of the search You can combine this with the file search Hit CTRL P and start searching for a file Then at the end of your search term add an sign and then the name of the function or method that you re looking for This will take you to that function or method in that file Coding Quicker With The Additional PHP Snippets The Additional PHP Snippets plugin disclaimer I m the author of this plugin provides a few simple text snippets to speed up everyday chores such as creating getters and setters and add license text to the top of the file It is available via Package Control Pull requests or requests for features are most welcome To use it inside your PHP code simply type php and ST2 will show you a list of all of the matching snippets Select the snippet you want hit TAB and hey presto the snippet is dropped into your code ready for you to adapt as required Creating Doc Blocks Using DocBlockr The DocBlockr plugin makes it very quick and easy to create doc blocks for your classes attributes and methods It is available via Package Control To use it open a new doc block as normal by typing and then pressing ENTER The plugin will create a template doc block for you to fill out to suit Real Time Syntax Checking Using SublimeLinter Real time syntax checking is something you take for granted with an IDE and it s available in ST2 in 2 main flavours I use the SublimeLinter plugin myself and have had no trouble with it at all but I know that some folks have had to use the sublime lint plugin instead Both are available via Package Control Once installed your code is checked in real time for syntax errors Lines that contain syntax errors are highlighted and in the status bar at the bottom of the screen you ll see an explanation of what the error is Sometimes the syntax error will appear to be on the wrong line on the line below where the real problem is SublimeLinter uses the php l command behind the screens PHP s built in linter and is simply reporting back exactly what the PHP runtime thinks is wrong This might puzzle you at first if you re used to IDEs that have their own lint algorithm built in Consulting The PHP Manual Using Goto Documentation The PHP Manual is imho PHP s true killer feature all that detailed documentation and it s all freely available on the web no need to go away and buy books on the language Like many PHP developers I ve always got the PHP Manual open when I m working The Goto Documentation plugin allows me to look up any PHP function from inside ST2 The plugin is available via Package Control and once installed you need to bind it to a key before you can use it This is done by opening the Key Bindings User option on ST2 s Preferences menu and adding a line like the following keys f1 command goto documentation Save the file and you re ready to go To use it just put your text cursor on the PHP function that you want to look up and hit your chosen key combination Goto Documentation will switch to your browser and search the PHP Manual for the function you ve selected Handling Trailing Whitespace Using The TrailingSpaces Plugin I know it s a small thing but trailing whitespace annoys the crap out of me and I ve always been deeply frustrated with how Netbeans never reliably stripped this from files that I created or worked on Thankfully this isn t a problem with ST2 and you can add the TrailingSpaces plugin to strip files in between saving them Testing Using PHPUnit The PHPUnit plugin disclaimer I am the plugin s author allows you to run your unit tests right from inside ST2 You can run the tests for just the file you ve got open or you can run all of your project s unit tests in one go You can also switch back and forwards between your PHP code and your unit test files and you can quickly open your project s phpunit xml file To use the plugin your project needs to have either a phpunit xml file or a phpunit xml dist file This is a simple config file that tells PHPUnit where your tests are which folders to include ignore for code coverage purposes and what reports logs PHPUnit should create once the testing is done If you re using something like Phix you get all of this for free and I believe that Symfony s standard app skeleton also includes a phpunit xml file too The plugin navigates around your project switching from file to file using the following algorithm It takes the full name of your PHP class including the namespace and uses the PSR0 autoloader algorithm to try and find the same class with Test appended on the end If that doesn t work it strips off the namespace and tries again To find the phpunit xml file the plugin finds the test code first and then searches each folder upwards for phpunit xml or phpunit xml dist If that doesn t work it looks in a number of pre determined locations defined in the plugin s settings file and then as a last resort it searches your whole project downwards starting from the top folder When you run your tests the full output from PHPUnit appears in a panel at the bottom of ST2 s window and that includes information on the full command executed and which folder it was executed from To close the panel just hit ESC Alignment Plugin This is a very simple plugin it allows you to select some lines of code and have all of the equals signs line up under each other I find that this can make code and especially array definitions much clearer to read but I know that it isn t for everyone Software Archaeology Using CTags One of the ways that IDEs add a lot of value is that they truly understand the code you re working on and that allows them to offer features like goto source definition et al There s a way you can do this in ST2 by installing the CTags plugin Once you ve installed the CTags plugin before you can use it you need to go to the plugin s website and follow the instructions there to get a suitable ctags command line program installed The plugin is a wrapper around this command s functionality and cannot work without it Then the next step is to build a tags file This is an index of all of your code that the plugin can use to look up classes functions and methods so that you can quickly jump to their definition from anywhere in your project This is done by hitting CTRL T and then CTRL R and then waiting for the finished building message to appear in the status bar After that you can navigate around your code by hitting CTRL T and then CTRL T again This works particularly well for exploring code you haven t seen before something that I demo in the video below One last word of advice CTags understands the syntax of your code but not the strategy It doesn t understand the difference between trunk and branches folders for example or vendor folders If there s code in there CTags by default will index it This might be what you want but if you find that it s picking up duplicates that you re not interested in you ll need to create a CTags sublime settings file in your User package folder to override the ctags command setting and add in some exclusions What Else There s one notable exception that I haven t covered here and that s SublimeCodeIntel This is a plugin that aims to bring Komodo s autocompletion over to ST2 It s a great idea but my own experience with the plugin isn t good I ve seen it installed on two different computers running the same OS and version of ST2 and it work fine on one and not work at all on the other I ve seen it stop working after a new version of the plugin was released I ve learned to live without it But do go try it out because if it works for you you might really like it Are there any other ST2 plugins that you use on a daily basis Mention them in the comments below and I ll check them out 111 comments 10 Reasons Why I ve Switched From Netbeans To Sublime Text 2 For PHP Development Posted by Stuart Herbert on February 20th 2012 in Opinion Toolbox I ve recently switched from using Netbeans as my PHP dev tool of choice to Sublime Text 2 Features wise I think Netbeans is great During the years I used it I never felt that there was a feature I needed that was missing at the time But like all the current crop of Java based desktop IDEs it s so damn ugly 1 and slow 2 that I ve had enough I program because it s something that I love doing and anything that gets in the way of that I ve no time for any more So when a work colleague introduced me to Sublime Text 2 I was in the mood to give it a go

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

  • Stuart on PHP -
    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

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

  • Stuart on PHP -
    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 We Need An Oktober blog Fest Posted by Stuart Herbert on October 3rd 2011 in Community After Chris Shiflett s Ideas of March call earlier in the year we had a fantastic period where the conversation moved from Twitter back to longer pieces on blogs Sadly that has faded out once more We need another blog revival To slightly paraphrase Chris s original call it s very easy to take part in Oktober blog Fest Write a post called Oktober blog Fest List some of the reasons you like blogs Pledge to blog more the rest of the month Share your thoughts on Twitter with the oktoberblogfest hashtag If we all blog a little more than we normally would this month maybe we can be reminded of all of the reasons blogs are great Over in Germany it s currently the OktoberFest where much beer gets consumed And it just happens that October is also one of the important months in the PHP conference calendar where much beer gets consumed There are two of the larger PHP conferences this month PHP NorthWest 2011 and ZendCon If you go to either of these conferences please blog about your experiences of the conferences the topics you see and hear and especially the fantastic ideas you come away with that you re dying to try for yourself Share the link to your conference blog post on Twitter with the oktoberblogfest hashtag so that we can all find and read your blog post It should be a great month of reading Be the first to leave a comment PHP Components Installing Phix On Debian 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 Debian 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 Debian Using The One Line Installer The easiest way to get phix installed onto your Debian server is to run the following command from a Terminal window curl O http phix project org installers debian 6 sh su c bash debian 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 Debian 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 OSX Posted by Stuart Herbert on October 2nd 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 Apple OSX users might want to follow these instructions for setting up PHP et al on OS X 10 7 Lion first before installing phix We assume that you ve installed Xcode which is free from the Mac Store Using The One Line Installer The easiest way to get phix installed onto your shiny Macbook Air or Macbook Pro is to run the following command from a Terminal window curl O http phix project org installers osx 10 7 sh sudo bash osx 10 7 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 Upgrades the PEAR installer to the latest version Uses the PECL command to install additional PHP extensions this is what you need Xcode for 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

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

  • Stuart on PHP -
    php flickrApiKey flickrSecret flickrToken f new phpFlickr flickrApiKey flickrSecret f setToken flickrToken f enableCache fs tmp 3600 first step find the first published blog post url http blog stuartherbert com photography rawHtml file get contents url preg match rawHtml matches blogPosts array flickrPhotos array latestPost matches 1 nextPost url p latestPost function updatePhotos photoIndex flickrPhotos blogPosts f foreach photoIndex as photoId flickrPhoto we must rewrite the description preg match Copyright s flickrPhoto description matches if isset matches 1 description matches 1 else description description Copyright c Stuart Herbert Blog Twitter Facebook n Photography Merthyr Road Daily Desktop Wallpaper 25 9 Twitter nn if count flickrPhoto blogPosts 1 description Want to know more about this photo See this blog entry nn else description Want to know more about this photo See these blog entries nn foreach flickrPhoto blogPosts as postUrl blogPost description blogPost title n description is made now to upload it echo Photo photoId flickrPhoto title n echo URL flickrPhoto url n echo Old flickrPhoto description n echo New description n echo nPushing changes to Flickr f photos setMeta photoId flickrPhoto title description echo donen while nextPost null photoIndex array echo Downloading nextPost rawHtml file get contents nextPost echo donen if rawHtml die Unable to download HTML for URL nextPost n preg match Us rawHtml matches postUrl matches 2 title matches 3 echo Blog post title is titlen echo Blog post url is postUrln preg match Previous Post rawHtml matches if isset matches 1 nextPost matches 1 else nextPost null preg match Us rawHtml matches if isset matches 1 die regex failed againn entryHtml matches 1 preg match all http www flickr com photos stuartherbert 0 9 entryHtml matches blogPosts postUrl url postUrl blogPosts postUrl title title blogPosts postUrl matches matches foreach matches 1 as flickrPhoto parts explode flickrPhoto photoId parts count parts 2 photoInfo f photos getInfo photoId flickrPhotos photoId url flickrPhoto flickrPhotos photoId title photoInfo title flickrPhotos photoId description photoInfo description flickrPhotos photoId blogPosts postUrl blogPosts postUrl note the photos we need to update because we have seen this post photoIndex photoId flickrPhotos photoId echo Photo photoInfo title n updatePhotos photoIndex flickrPhotos blogPosts f echo nn echo Photo scraping complete nn when we get to here we have photos to go and update on flickr code 1 comment PHP South West phpsw User Group Meeting 7pm Wednesday 9th February 2011 Posted by Stuart Herbert on February 1st 2011 in phpsw February s meeting of the PHP SouthWest User Group will be at The Golden Guinea in Redcliffe Bristol from 7pm on Wednesday 9th February What Is Planned I m speaking at the PHP UK conference later in February and will be practising my talk No guarantees but I think Rob Allen might be practicing his talk too How To Get There We ll be at The Golden Guinea 19 Guinea Street Bristol BS1 6SX It s a short walk from Bristol Temple Meads Railway Station if you re coming by train How To Get Involved Please join the

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

  • Stuart on PHP -
    you re a project manager software developer web site designer with XSL experience or a systems administrator maybe we have the right opportunity for your next role Be the first to leave a comment PHP London Conference Is Packed Out Posted by Stuart Herbert on February 23rd 2007 in Conferences Mmm the sold out sign on the PHP London Conference s home page doesn t do it justice Packed out would be a much better description There isn t an empty seat in the house and during the talks there are quite a few folks standing at the back or sitting on the floor It s fantastic to see such a well supported conference here in the UK I don t remember coming across anyone else from the UK at the PHP conferences I ve been to overseas Apart from Cal and Yair representing Zend everyone else I ve spoken to has been a developer For all the attention that Rails has grabbed in the last twelve months it s great to see that interest in PHP if anything is stronger than it was a year ago If anyone s interested in having a chat about the Why PHP group let me know I m sat on the back row just to the left of the main doors 2 comments Going to PHP London Conference Posted by Stuart Herbert on February 16th 2007 in Conferences PHP In Business I ll be making the bleary eyed trek over from Cardiff on Friday morning I m more liking to be heading off to bed at 5am than getting out of one to the PHP Conference in London If you re going to the conference too and you d like to meet up afterwards or over lunch to talk about the Why PHP effort please head on over to the group and let us know Be the first to leave a comment What Does The Business Case For PHP Need To Cover Posted by Stuart Herbert on February 8th 2007 in PHP In Business In my last post I asked whether there was any interest in there being a resource that makes the business case for PHP Many thanks to everyone who replied especially David Goulden at Zend To turn this from an idea into reality I ve setup a Google group where anyone who is interested can join in and help build this resource Please come along with your ideas and concerns and let s see what we can achieve together I don t know what other folks think but I think the first step is to draw up a list of topics that the business case needs to cover Run into a question from a customer that stops you selling your PHP solution Let us know 3 comments Missing The Business Case For PHP Posted by Stuart Herbert on January 17th 2007 in PHP In Business At work we make and sell software written in a number of languages our flagship product is written in PHP During pre sales we ve always had to handle some questions about our choice of PHP normally from IT staff with a preference for Java or lately NET and we normally manage to convince the potential customer that PHP isn t the bad choice that they ve been led to believe But one of the unfortunate side effects of Stefan Esser s much publicised self publicised departure from the PHP Security Team has been an increase in the number of IT staff we re coming across who believe both that open source is inherently insecure and that PHP in particular has incurable problems These beliefs hurt ISVs trying to sell PHP based applications into skeptical organisations Why isn t there a central resource containing the answers to Why PHP in a business oriented way Something that ISVs can refer their clients to and it not only promotes the excellent advantages of PHP and include success stories from vertical markets but also include substantial rebuttals to the FUD that ISVs have to deal with during the pre sales process I m not surprised that PHP net doesn t contain such a resource it s not really the place for it one could argue but it s disappointing to see that Zend doesn t provide one What s good for ISVs should be good for Zend after all and this is an area where they could help all the ISVs that they want to sell their products to Is there interest from other folks in having a resource like this Or maybe working together to build such a resource 21 comments Using SimpleXML To Parse RSS Feeds Posted by Stuart Herbert on January 7th 2007 in 1 Beginner Examples I ve recently switched my blog from b2evolution back to WordPress The good news is both no more spam and the admin panel works in Safari but on the downside I missed the multiblog feature that attracted me to b2evolution in the first place There is WordPress MU I suppose but after coming across a few plugins that warned they didn t work with WordPress MU that option didn t look very appealing Ah ha thinks I I can fake the multiblog by putting several different blogs on the site and generating a homepage from the RSS feeds of the individual blogs Should be simple enough and it sounds like the perfect nail to hit with the SimpleXML hammer of PHP 5 Funnily enough in work last week we were wondering whether you could use SimpleXML with XML namespaces alas we still use PHP 4 at work atm so armed with the perfect excuse I set to work Getting an RSS 2 feed into SimpleXML is trivial code lang php feedUrl http blog stuartherbert com php feed rss2 rawFeed file get contents feedUrl xml new SimpleXmlElement rawFeed code Extracting the information from the RSS channel is equally trivial code lang php channel title xml channel title channel link

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



  •