background preloader


Facebook Twitter

Easy Wins For More Performant PHP. Introduction.

Easy Wins For More Performant PHP

Laravel Cheat Sheet. Check Member's/ User's Online or Offline Status. Introduction The following piece of code will calculate the last visited time of a Member/User and calculate the time difference with the current time. And if the Member/User's last visited time is greater than 10 minutes then that will be considered OFFLINE status, otherwise ONLINE. Background I was just searching for a time difference code in Bakery but couldn't find any simple code. Accessing Incoming PUT Data from PHP. Recently I started writing a REST service.

Accessing Incoming PUT Data from PHP

I began in the usual way, writing a php script, calling it with a GET request, accessing the variables using the PHP superglobal variable $_GET. I wrote code to handle a POST request and used the variables I found in $_POST. Then I tried to write a PUT request. 20 All Too Common Coding Pitfalls For Beginners. Regardless of our current skill level, we all were beginners at one point in time.

20 All Too Common Coding Pitfalls For Beginners

Making classic beginner mistakes comes with the territory.


Login. Formulaires. PHP Coding Guidelines. These are the guidelines that I follow when writing my PHP scripts, unless a coding standard already exists for the project I’m working on.

PHP Coding Guidelines

It can be helpful to have something like this if you’re working on a joint project. N.B. These are only the guidelines that I personally chose to follow for the code I write. This is not an indication that any other coding styles, guidelines or standards are wrong. Feel free to use this document as a template to manage your own coding guideline and change whatever you wish as you see fit. Why are guidelines important? First of all, let’s make one point clear: it doesn’t matter what your guidelines are, so long as everyone understands and sticks to them. It cannot be emphasised enough that guidelines are only useful if they are followed.

Editor settings Tabs v. spaces Ahh, the endless debate of tabs v. spaces. Linefeeds The three major operating systems (Unix, Windows and Mac OS) use different ways to represent the end of a line. Php-mobile-detect - PHP class for mobile device detection. Working with Files in PHP. You may well be familiar with databases such as MySQL and Access which are an ever-increasingly common means of storing data.

Working with Files in PHP

But data is also stored in files, like Word documents, event logs, spreadsheets, image files, and so on. Databases generally require a special query language to retrieve information, whereas files are ‘flat’ and usually appear as a stream of text. S blog: PHP Sucks! But I Like It! I read a rather interesting post yesterday called PHP: a fractal of bad design. It's been getting a lot of traffic among the PHP community lately because it's rather inflammatory. But to be honest, it does make a lot of really good points.

Phpquery - phpQuery - jQuery port to PHP. Pewpew - PHP's Embedded Webserver. This is a tiny tool that allows you to launch the built in PHP 5.4 HTTP test server with a few clicks.

pewpew - PHP's Embedded Webserver

It allows you to select which PHP binary you want to use (in case you have multiple on your system) and the document root of the test server. Click the picture for a larger screenshot of the application running. Grocery Crud - Un générateur de CRUD basé sur CodeIgniter. PHP Bug Lost - Déboguer et monitorer vos applications. Gérer l’envoi de SMS en PHP : TextMagic vous aide. Avez-vous déjà remplacé l’envoi d’un mail par un SMS ?

Gérer l’envoi de SMS en PHP : TextMagic vous aide

En effet, tout comme de nombreux sites le proposent désormais, envoyer un notification par un message texte, autrement dit un SMS, au lieu d’une notifications par courrier électronique, autrement dit un mail, peut être très utile dans le cas d’informations sensibles, ou urgentes. Après quelques fouilles sur le Web, j’ai retenu quelques solutions, dont il est très simple de mettre en place. Hypertext Preprocessor. Creating a Secure Login System the Right Way. Making a custom login system is a common task for beginning PHP developers.

Creating a Secure Login System the Right Way

Jumping right into it, however, may not be the best approach. There are several important aspects to building a login system that not only makes it work, but makes it safe. Updated on December 15th 2009: Added Session Control Section Updated on December 15th 2010: Switched to sha256. 10 super useful PHP snippets you probably haven’t seen. Text messaging with PHP using the TextMagic API If for some reason, you need to send text messages to your clients cell phones, you should definitely have a look to TextMagic.

10 super useful PHP snippets you probably haven’t seen

They provide an easy API which allow you to send SMS to cell phones. Please note that the TextMagic service isn’t free. If PHP Were British. When Rasmus Lerdorf first put PHP together, he - quite sensibly, despite his heritage - chose not to write it in Greenlandic or Danish.

If PHP Were British

Good job too - that would have been rather unpleasant to work with. He opted instead, being in Canada, for a more local tongue. No, not French. Free Online Tutorial PHP - PAGE. Twig - The flexible, fast, and secure PHP template engine - Homepage. Détecter si le visiteur vient d’un iPhone iPad iPod Android. Avec tous ces mobiles et surtout les forfaits qui vont avec, la part des visiteurs venant d’un mobile est à présent significative. Le hic est que les tailles d’écran proposé (à part le iPad qui n’est pas un mobile…) est souvent minuscule, et donc, très souvent le site visité est inapproprié à la navigation sous mobile. Il existe 3 solutions de détection: Avec un fichier .htaccessAvec un script PhpAvec du Javascript Détection htaccess L’avantage: le visiteur est redirigé de suite sans charger la page par défaut.

L’inconvénient: il faut réécrire un site compatible Le principe est simple, dans un htaccess, on va chercher dans le User Agent (String envoyée par le navigateur pour chaque requête HTTP) la présence de mots clés: “iphone,ipod,android” etc etc liste que vous pouvez largement continuer avec palm,smartphone,toshiba,sony,nokia…. bref la liste peut être très très …. longue…Puis si la condition est TRUE, on redirige la requête vers un sous domaine: 10 super useful PHP snippets. We Recommend These Resources Having the right code snippet at the right time can definitely be a life saver for web developers. Today, I’ve compiled 10 really awesome PHP code snippets that will, I hope, be very helpful in your forthcomming developments.

11 jQuery and PHP Tutorials. Geo Tools. Adaptive Images - Des images adaptées auto aux résolutions écran. Adaptive images est un kit Javascript et PHP permettant d'optimiser l'affichage de vos images en fonction de la résolution de votre navigateur. Toujours à la quête de l'optimisation frontend des sites web, Adaptive Images vous permettra de gagner énormément en ressources en proposant une version de vos images adaptée à la taille de votre navigateur. Imaginons que vous proposiez une image de 242kb sur votre site web, adaptée pour les grosses résolutions... les navigateurs mobiles vont télécharger la même image, mais souvent sur un réseau mobile ! Lent, très lent ! Grâce à Adaptive Images, vous n'avez rien à modifier dans votre code, simplement intégrer le fichier .htaccess, le script et fichier PHP pour redimensionner à la volée (si image non présente en cache) pour la version miniature. On passe donc de 242kb à 39kb pour notre smartphone.

Site Officiel. [PHP 5.1] Classe d'Upload et Redimensionnement. Object-Oriented PHP: Working with Inheritance. Dompdf - HTML to PDF converter (PHP5) Benchmarks. Phar – PHP archiving practice. Phar – PHP archiving practice Today we will continue PHP lessons. I guess you noticed that due your project become larger – the more and more files it contain. Sometimes it comes to the thousands of files. And then – Phar can help you. This utility allows us to pack a variety of files in the single library file. Phar extension appear in PHP since version 5.2. Make attention, by default, the PHAR archives have read-only access (so you will unable to create it). In our lesson, I will tell you how you can create own libraries and use it. Download in package Ok, download the example files and lets start coding !

Step 1. Firstly, lets prepare 2 sample classes for us: classes/SampleClass.php. Les flashcodes, comment les générer automatiquement et facilement avec PHP. Photobooth with PHP, jQuery and CSS3.