Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Laravel News:
Leverage Eloquent To Prepare Your URLs
Apr 18, 2018 @ 16:44:13

The Laravel News site has a quick tutorial posted showing you how you can use Eloquent functionality to help prepare your URLs and make them easier to maintain across the application. The key is in the use of "presenters".

It’s not uncommon to have tens, if not hundreds of views in a Laravel application. Something that soon gets out of hand is the various references to routes. [...] If for whatever reason we have to make a change to either the route alias or default query string values you’ll soon find yourself doing mass string replacements across your entire application which brings the risk of breakage within many files.

What can we do to possibly better handle this? There are a couple of different approaches.

They provide two approaches, one being slightly more complex (but flexible) than the other. The first makes use of only Eloquent to define a getUrlAttributes method in the model. The second method abstracts this functionality out to a "URL Presenter", a class that defines methods for each of the CRUD actions and returns the correct route for each. The getUrlAttribute then returns an instance of this instead, making it easy to reference the method and route required in the Blade template.

tagged: laravel eloquent prepare url tutorial presenter

Link: https://laravel-news.com/leverage-eloquent-to-prepare-your-urls

Digital Ocean Blog:
Getting Ready for PHP 7
Jul 16, 2015 @ 17:31:48

The Digital Ocean blog has posted a guide to help you get ready for PHP7, the next major release of the PHP language. There's a lot of new functionality and changes coming with the release along with plenty of performance and consistency improvements.

2015 has been an important year for PHP. Eleven years after its 5.0 release, a new major version is finally coming our way! PHP 7 is scheduled for release before the end of the year, bringing many new language features and an impressive performance boost. But how this will impact your current PHP codebase? What really changed? How safe is it to update? This post will answer these questions and give you a taste of what’s to come with PHP 7.

They start with a brief look at some of the overall performance improvements PHP7 will introduce and a few things to watch out for that may break with the upgrade (like deprecated features and engine exceptions). From there they get into some of the new language features:

  • New operators (spaceship, null coalesce)
  • Scalar type hinting
  • Return type hinting

They each have brief code examples showing how they'd be put to use but there's also links to other resources with more information if you need them.

tagged: introduction php7 prepare changes deprecate update performance

Link: https://www.digitalocean.com/company/blog/getting-ready-for-php-7/

7PHP.com:
Prepare for the PHP Master Series, v1 (Interviews & Content)
Dec 12, 2012 @ 19:27:01

If you're planning on attending the PHP Master Series (a full-day live webcast "conference" with several notable PHP speakers presenting) and want to prepare yourself for some of the content that will be presented, check out this post on 7php.com with a good preview.

Unfortunately, just like me, you are not able to attend PHP conferences overseas due to so many reasons (travel/booking costs, no day-off from fulltime job..etc). How much of a frustration that is, I don’t know for you but for me it’s really something very sad! I’m someone who wants to mingle and jingle in those PHP fiesta. [...] In this attempt [to make godo content available to more people], @CalEvans has brought forward a first volume of PHP Master Series. You can read about the announcement from Cal’s Blog here!

The article talks about each of the speakers, links to their community interviews (also on 7php.com) and shares some new interview content from each of them about the content they'll be presenting and what they think about the event as a whole.

The PHP Master Series, v1 will be presented on Friday, December 21st and the cost is $50 USD for the full day of presentations and video.

tagged: phpmasterseriesv1 webcast prepare interview community

Link:

Martin Psinas' Blog:
Switching to PDO
Aug 04, 2011 @ 15:17:59

In a new post to his blog Martin Psinas talks about some of his pains experienced with upgrading his code to use PDO instead of the mysql extension for database interaction.

I read not too long ago that the mysql library in PHP is being deprecated as of v6.0 in favor of mysqli or PDO, so of course I had to update all of my database code keep on top of things. I spent about 5 or 6 hours over the course of 2 days familiarizing myself with the new syntax and updating my code offline. Without any testing, I decided I could go ahead and push the code "live" because I'm just that over-confident sometimes, although I did make a backup in case anything went wrong (or so I thought).

Two problems jumped out immediately - a SQL error caused by this bug and the other being a problem with preparing his statement inside of a session handling method.

tagged: pdo mysql switch problem prepare session limit bug

Link:

Lorna Mitchell's Blog:
Preparing for ZCE 5.3
Dec 20, 2010 @ 14:37:56

Following up on a previous post about taking the Zend Certified Engineer exam (5.3 version), Lorna Mitchell has posted some details about how she prepared for (and passed) the test.

In the last few weeks I've both passed the certificate myself and also taught Zend's certification training course as a classroom course at NTI Leeds. I thought I'd share my top tips for preparing for taking the ZCE - getting to the standard, last-minute preparations, and also some tips for surviving the day itself (disclaimer: everyone sitting the ZCE signs a declaration not to disclose the contents of the exam, so I can't actually tell you the questions, sorry!)

She recommends that only developers with at least a year or two of using PHP regularly take the exam due to the amount of PHP knowledge needed. If you haven't at least touched on most aspects of the language, you might have a difficult time with it. She also points out the lack of up-to-date training materials, some of the things she did the night before as a refresher and a few tips for specific parts of the exam.

tagged: zec prepare opinion exam zendcertified

Link:

Content with Style Blog:
Zend Framework DB and Mysql pre 5.17
Oct 09, 2009 @ 15:33:12

The Content with Style blog has a gotcha that Zend Framework developers could come across if they're using MySQL pre-5.17:

was getting weird errors when running multiple queries with Zend Framework, that I just couldn't replicate on my local environment. [...] Turns out the server runs MySQL pre 5.17.

This caused a stack trace error where the queries wouldn't run correctly. The solution was (like the error message suggests) turning on query buffering with the "PDO::MYSQL_ATTR_USE_BUFFERED_QUERY" in the PDO connection's parameters. You can find out more information about the parameters you can pass to the adapter in this section on the Zend Framework' Zend_Db manual page.

tagged: mysql prepare query zendframework zenddb

Link:

Kevin van Zonneveld's Blog:
Prepare for PHP 5.3
Jul 30, 2009 @ 17:25:33

In this new post to his blog Kevin van Zonneveld looks to help you make the transition up to the latest version of PHP (5.3) in a Ubuntu Jaunty installation (including a few things to specifically watch out for).

PHP 5.3 is a big leap forward for PHP and brings of a lot of neat features. However, big leaps can also mean big changes and potentially big breakage when it comes to backwards compatibility. I did some experimenting with running a big legacy application and a CakePHP application on PHP 5.3 and would like to share my findings with you. Here are a couple of tips to prepare your code for PHP 5.3

He mentions things like:

  • Updates to short tag support
  • Deprecation warnings
  • MySQL driver support
  • Extensions
tagged: php5 prepare update ubuntu jaunty

Link:

PHPClasses.org:
Is the PHP certification worth it? (Interview)
May 28, 2008 @ 17:04:09

In this new post to the PHPClasses.org blog, Manuel Lemos looks at the PHP Certification Exam - whether it's worth it, how can you take it and includes an interview with a ZCE, Mauricio Garcia about his experience with it.

Although I am certain that having a PHP certification is not the only way to demonstrate that a PHP developer is really qualified, I am sure that it helps hinting employers about his skills, and so become more open to negotiate better salaries. Having a PHP certification also helps a developer stand out from the crowd of developers that apply to a job but do not have any certification.

In the interview Manuel talks with Mauricio (a Brazilian PHP developer) about whether or not he feels the certification is worth it, how a developer can take it and what they need to do to prepare for it as well as a mention of a book that might help.

Michael Kimsal has also posted some of his own thoughts on the certification issue (and of the comments made during the interview).

tagged: interview zce certification worth exam prepare

Link:

Michael Kimsal's Blog:
Why I think PDO sucks
Apr 03, 2008 @ 00:38:10

Michael Kimsal has posted his opinion on why PDO, the database interface layer for PHP, sucks.

Every so often I try to use PDO under PHP5, and every time I run in to basic functionality problems with no ability to find out what's going on under the hood.

He includes a few comments supporting his statement including an issue where a prepare() call didn't work, his frustration with not being able to see what's "under the hood" and the lack of documentation to help with these sorts of issues.

tagged: pdo opinion issue documentation prepare

Link:


Trending Topics: