Domnikl/DesignPatternsPHP. 25 PHP Developers to Follow Online. Building PHP frameworks is hard, but following these PHP source and framework committers on Twitter is easy. You’ll learn lots of interesting bits about what’s happening in their respective communities, and if you want to see where the PHP and PHP framework communities are going next, just watch your feed for these folks. Here’s a list of 25 PHP developers we’re following online.
We hope you find their expertise useful and be sure to check back for more PHP-related posts to come. 1. Rob Allen. Zend Framework contributor, Zend Framework Education Advisory Board member, and co-author of Zend Framework in Action. Owner of Nineteen Feet.BlogTwitterGitHubStack Overflow 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. PHP Testing Basics - Tuts+ Course. 8 Must Have PHP Quality Assurance Tools. Quality Assurance in PHP is a valuable but very rarely seen aspect. In a world focused on rapid deployment and a “ship now, worry later” mentality, a focus on quality is a rare sight, especially when dealing with the web. One of our authors recently directed my attention to Sebastian Bergmann’s site, PHP QA Tools.
The site is a simple list of interesting tools that can help you properly test your application, while also analyzing it and producing interesting data for you to look at. This post will be little more than a re-iteration of some of those tools with added information, use cases and advice about them – however, we’re open to expanding this list with other QA tools you throw our way that get plenty of votes in the comments below or seem interesting and/or useful enough. 1. PHPUnit Mr. PHPUnit can be installed globally, by running composer global require "phpunit/phpunit=4.1. *". 2. You then write classes with methods which define the specific sentences, such as: BDD vs TDD 5. 6. Setting a timeout for PHP sessions. Introduction In this article I aim to explain the reasons why PHP sessions expire after a set period of inactivity, and how this mechanism works.
I'll describe two commonly used methods to control the lifetime of a session, and show how to do so in your code. The problem PHP's session mechanism allows us to store data for clients on the server to make it persist through multiple requests. However, because the data itself is stored on the server, and the only thing connecting client's to their respective sessions on the server is a simple cookie, this creates a major security concern. An exploit known as session hijacking is when a malicious third party intercepts or steals the session cookie from a client, and uses it to access the data from an active session. The solution The most important defense we have against this is to disregard sessions that have been inactive for a set period.
In PHP the mechanism that implements this is known as the session garbage collector. PHP Cheat Sheet. Array Array Constants CASE_LOWER Used with array_change_key_case() to convert array keys to lower case CASE_UPPER Used with array_change_key_case() to convert array keys to upper case SORT_ASC Used with array_multisort() to sort in ascending order SORT_DESC Used with array_multisort() to sort in descending order SORT_REGULAR Used to compare items normally SORT_NUMERIC Used to compare items numerically SORT_STRING Used to compare items as strings SORT_LOCALE_STRING Used to compare items as strings, based on the current locale COUNT_NORMAL COUNT_RECURSIVE EXTR_OVERWRITE EXTR_SKIP EXTR_PREFIX_SAME EXTR_PREFIX_ALL EXTR_PREFIX_INVALID EXTR_PREFIX_IF_EXISTS EXTR_IF_EXISTS EXTR_REFS String String Constants CRYPT_SALT_LENGTH Contains the length of the default encryption method for the system.
Date/Time Date/Time Constants Directory Directory Constants Error Error Constants E_ERROR1 Fatal run-time errors. Math Math Constants Filesystem Filesystem Constants Calendar Calendar Constants FTP Constants Libxml Mail Ad. An Opinion On The Future Of PHP. There's been a lot of buzz in the community lately around PHP and its future. The vast majority of this buzz has been distinctly positive, which is awesome to hear. There's been a lot of talk about PHP6 and what that might look like. There's been a lot of questions around HHVM and its role in the future of the language and community.
Well, let me share with you some of my thoughts in this space... On Backwards Compatibility In my opinion, backwards compatibility must be mostly maintained in a future major release (call it 6, 7, 99, "enthusiastic elephpant", whatever). Now, when I say "mostly", I do mean that some controlled breaks should happen. There's a really simple test to see if this is maintained: It must be easy to write a single codebase that executes on 5.X and 6.X (and any two consecutive major versions) Why is that important? Well, as it turns out, we don't have to imagine. I don't want to say that it's a mistake to do that. On An Engine Rewrite The Rise of HHVM Absolutely.
Symfony 2.3, el libro oficial. (18) PHP (programming language): Why is PHP hated by so many developers. How to create include path for PHP in five ways. Five ways to create include path for PHP One thing that people often complain about PHP is that there are always more than one way to do the same thing in PHP. This is very true for PHP includes. Here are 5 ways to create PHP include path. Use php.ini Use .htaccess Use ini_set function Use set_include_path function Manually code the path Method #1: Use php.ini to create include path If PHP is compiled as a CGI binary, you can use php.ini to create include path. If you have no direct access to php.ini on the web server (e.g. you are using shared web hosting), you can create a custom php.ini on your hosting account's web root directory.
Don't want to place php.ini in every subfolder? GeeksEngine is hosted by LunarPages where PHP is compiled as CGI. SuPHP_ConfigPath /home/username/public_html/ where "username" is your cPanel username. To create include path in your php.ini file, download your current php.ini from your website by using a FTP client, or create a new one if you don't have it yet. S blog: Security Review: Creating a Secure PHP Login Script. The other day, an article popped up in my feed reader that had a very interesting title (to me at least), Simple and Secure Login Script. As usual, I decided to click the link and give the article a read. Not overly shocking was the fact that I didn’t find the content of the article to be, how shall I say this…, overly factual. It’s not really a “tutorial”, but more of a “here’s some code that’s secure”.
A quick review of the code found more than one vulnerability, and some significant things that I would change about it (as well as a few “really bad practices”). So, rather than write a “rant post” about the code, I’ve decided to take another tactic. The first thing that I see when I open that code up is a whole bunch of mess. So, the first actual step towards reviewing the code that I take, is to get a general understanding of the architecture of the codebase from a reasonably high level. Session Initialization (Authenticate.php lines 37 - 88) Notice the order of execution there.
Sculpin — PHP Static Site Generator. DrupalCamp México 2014. PHP: a fractal of bad design - fuzzy notepad. (This article has been translated into Spanish (PDF, with some additions) by Jorge Amado Soria Ramirez — thanks!) Preface I’m cranky. I complain about a lot of things. There’s a lot in the world of technology I don’t like, and that’s really to be expected—programming is a hilariously young discipline, and none of us have the slightest clue what we’re doing. Combine with Sturgeon’s Law, and I have a lifetime’s worth of stuff to gripe about.
This is not the same. PHP is not merely awkward to use, or ill-suited for what I want, or suboptimal, or against my religion. PHP is the lone exception. PHP is an embarrassment, a blight upon my craft. But I’ve got to get this out of my system. An analogy I just blurted this out to Mel to explain my frustration and she insisted that I reproduce it here. I can’t even say what’s wrong with PHP, because— okay. Stance I assert that the following qualities are important for making a language productive and useful, and PHP violates them with wild abandon. Text. (86) Phil Sturgeon's answer to PHP Frameworks: Laravel vs CodeIgniter: which one is recommended. 5 Things CodeIgniter Cannot Do (without a rewrite) Now that PHP 5.2 is gone from my life entirely I am a happy man. As I don't use PHP 5.2 anymore I no longer need a 5.2 framework, so I quit the CodeIgniter team and started focusing on my new job. Kapture is all PHP 5.4, and PyroCMS is moving to be PHP 5.3, so I can use anonymous functions, short ternary operators, namespaces, go fully PSR-2 and use Composer all the way.
PHP 5.3 is a massive change from PHP 5.2 as of course it was meant to be PHP 6, so while it might SEEM like a small update it's really not. It opens up doors to whole new possibilities, a newer more mature style of programming and sucks SO MUCH LESS than earlier versions of PHP. Most of the features added to PHP before this have not fundamentally changed the way a framework should look.
Other than that, nothing has happened to break existing applications even though we managed to add a whole bunch of features. 1. As features started popping in to PHP 5.1, 5.2 a rewrite was suggested by hundreds of users. 2. 3. 4. 5. PHP: The Right Way. Syntax Check PHP 5.3 File. Meandeviation.com > learn php > php syntax check 5.3 Many PHP systems are configured not to show syntax errors (or other errors) on production web servers.
If you are running a separate development server or running a server on your own PC you can set the display_errors flag to true in php.ini. This will also make it easier to check other kinds of errors. However, if you cannot do this for some reason, or you just want a quick check of the PHP syntax, then this page is for you! Simply select the PHP file you would like below and then press 'Check this File'.
You can download this script (tarball): php-syntax-check.tar.gz It will need some configuring for your system. Note this will checked against PHP 5.3. Alternative versions are available for PHP 4, PHP 5.2. PHP Code Checker - Syntax Check for Common PHP Mistakes. PHP Image Rotation Iphone Portrait EXIF Orientation GD2 and imagemagick Libraries | Ken Dawson. I was adding PHP image upload and delete functions to an application the other day – when I came upon a few problems. The iPhone 4S images that were taken in Portrait mode, and then uploaded, did not display with the appropriate portrait orientation (The orientation of the camera relative to the scene, when the image was captured.).
They were saved on the iPhone, still in the Landscape mode – although they were taken as Portrait. For whatever reason, the iPhone 4S saves both Portrait and Landscape images with the same Landscape (Width greater than Height) display orientation. The Problem: I can’t use the standard methods to detect which image is actually portrait or landscape – as both Landscape and Portrait are saved as width=”3264″ height=”2448″. The Portrait images uploaded were displaying as Landscape. The Solution: Read the EXIF Header Data within the image. $source_image = '.. orientation image camera exif dataImage form.
Estándares de codificación en PHP (PSR0, PSR1, PSR2 y PSR3) Publicado hace 3 meses en estandares , php , psr0 , psr1 , psr2 y psr3 por CodeJobs Hola a todos, en esta ocasión me gustaría hablarles un poco sobre estos estándares de codificación en PHP (PSR0, PSR1, PSR2 y PSR3) los cuales son aceptados por la gran comunidad de PHP. Este es el primero de los estándares y nos especifica las siguientes reglas: Puntos Obligatorios Los namespaces y las clases deben tener la siguiente estructura \<Vendor name>\(<Namespace>)*<Class Name> Cada namespace debe tener un namespace superior ("Vendor name"). Cada namespace puede tener tantos sub-namespaces como se quiera.
Ejemplos: PSR-1, PSR-2 y PSR3 Convenciones Los archivos deben utilizar solamente <? Ejemplos La documentación en los códigos debe ser cómo el siguiente código: Para más información pueden visitar el repositorio oficial del estándar. PHP Class for converting XML to Object and Object to XML « A K Chauhan’s Blog. How to Debug PHP Using Firefox with FirePHP. Typically, there are two main ways of debugging server-side code: you can utilize an Integrated Development Environment (IDE) with a built-in debugger or log and perform your debugging processes in a web browser. This article shares an elegant, simple, and more maintainable way of debugging Ajax apps via the web browser (more specifically for the Mozilla Firefox browser).
You’ll learn the basics of leveraging Firefox in conjunction with Firebug and FirePHP to implement FirePHP libraries on web apps and logging messages in the Firebug console. A Brief Introduction When Ajax techniques became popular, developers faced a new problem: how can we debug Ajax requests and responses efficiently for complex web applications?
In this somewhat risqué episode, we’ll look at just what you need to be able to do development work on the i. IBM and Zend The Zend product itself consists of three components. RC4 Crypt.