background preloader


Facebook Twitter

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. 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. Today, we've asked a variety of Nettuts+ staff authors to chime in with their list of pitfalls and solutions - in a variety of languages. Learn from our mistakes; don't do these things! JavaScript Tips.


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.

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. Most often when working with files you’ll read from or write to them. When you want to read the contents of a file you first have to open it, then read as much of the contents as you want, then close the file when you’re finished. When writing to a file, it also needs to be opened (or perhaps created if it doesn’t already exist), then you write your data to it, and close the file when you have finished. 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. PhpQuery is a server-side, chainable, CSS3 selector driven Document Object Model (DOM) API based on jQuery JavaScript Library.

phpquery - phpQuery - jQuery port to PHP

Library is written in PHP5 and provides additional Command Line Interface (CLI). PEAR installation pear channel-discover pear install phpquery/phpQuery GitHub Fork & pull request: Download Manual. 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. Grocery Crud est un générateur de CRUD PHP basé sur le framework CodeIgniter.

Grocery Crud - Un générateur de CRUD basé sur CodeIgniter

Dans vos applications web et en particulier dans vos espaces d'administration, vous répétez toujours les mêmes tâches à savoir: Créer une fonction de listing, de création d'une nouvelle entrée, la fonction de modification et celle de suppression. 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 Getting Started To begin with, we’ll create our login form. The above example is stripped down; there is no formatting or styles so it will most likely won’t look to great if you copy and paste the code. Notice that our input fields are given name attributes, this is important as we will need to identify and access these values by this name.

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. 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. Not Canadian English either. No, he went for that bastard dialect of the Queen's English commonly referred to as "US English". 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. 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. [PHP 5.1] Classe d'Upload et Redimensionnement.

Object-Oriented PHP: Working with Inheritance. Home : Articles : Object-Oriented PHP: Working with Inheritance Tutorial by Matt Doyle | Level: Intermediate | Published on 26 May 2011. Dompdf - HTML to PDF converter (PHP5) Dompdf is an HTML to PDF converter. At its heart, dompdf is (mostly) CSS 2.1 compliant HTML layout and rendering engine written in PHP. It is a style-driven renderer: it will download and read external stylesheets, inline style tags, and the style attributes of individual HTML elements.

It also supports most presentational HTML attributes. PDF rendering is currently provided either by PDFLib or by a bundled version the R&OS CPDF class written by Wayne Munro. Benchmarks. Phar – PHP archiving practice. Les flashcodes, comment les générer automatiquement et facilement avec PHP. Posté le 21 mars 2011 dans Développement web , par Abdelhak - Caroline nous expliquait dans un précédent article ce qu’est un flashcode, comment ces codes sont utilisés, etc. Nous, on fait beaucoup de PHP, tout les jours, et on aime bien se sentir rassuré de temps en temps en se disant avec PHP on peut tout faire ! Photobooth with PHP, jQuery and CSS3.