Feed aggregator

Best PHP IDE in 2014 – Survey Results

Planet-PHP - za, 22/03/2014 - 21:11

Exactly one month ago, we opened the Best IDE of 2014 survey. 4000 entries later, it’s time to share the results with you.

Continue reading %Best PHP IDE in 2014 – Survey Results%

Categorieën: Open Source, PHP Community

Birthday reminder by mail

Planet-PHP - za, 22/03/2014 - 14:50

End of november 2000 I published my first freeware program, RealDreams birthday reminder. I wrote it in C++ on Windows using Visual Studio. It was postcard-ware; I asked people to send me a postcard if they liked it. All in all I got about 400 postcards from all parts of the world :)

It had a loyal user base, got translations for half a dozen languages and I made beta tests by sending new versions by e-mail to interested users..

In 2003 I switched to Linux and had to use Wine to keep birthday reminder running. I wrote birthday reminder 3, this time in Java - it ran on my computers, my parent's Mac and other people's windows boxes. Unfortunately, it never reached the full functionality of its predecessor and thus stayed at version 2.95.

birthday reminder was made to run whenever you startup your computer; an event that I rarely do since 2006. Close the lid - the computer sleeps. Open it, it's awake. With rare startups, birthday reminder was invoked very seldomly, losing its usefulness.

bdrem

The only thing I regularly do is - apart from using the terminal - to check my mails. birthday reminder by e-mail was born.

Since I use an LDAP address book, a LDAP source driver was added. At work we use a proprietary CRM, so I added a generic SQL driver to be able to get reminders about our customer's birthdays.

bdrem is able to send emails. For text-only mail clients an ASCII table with upcoming events is included, generated with Console_Table. Mails also contain a colorful html table. The MIME mail is composed with Mail_mime.

bdrem html output

.phar

bdrem is distributed as a .phar file, containing all dependencies. No need to install anything; just run

$ php bdrem.phar

In 2011 I wrote about working with .phar files, and now I did actually use ideas from that blog post:

$ php bdrem.phar --help
Show help
$ php bdrem.phar config
Extract default configuration file
$ php bdrem.phar readme
Show README
Dependencies

I use phing to automatically build the .phar file. Since I wanted to include all dependencies, I had to make some patches to copy pear package contents (#271, #272, #273, #274) and to make .phar generation work properly (#268). While being at it, I improved phing's documentation and made it more usable (#266, #269, #270).

With all the patches in place, I can collect my dependencies with that code:

 

Truncated by Planet PHP, read more at the original (another 3063 bytes)

Categorieën: Open Source, PHP Community

A helpful Twig extension – Fetch

Planet-PHP - za, 22/03/2014 - 13:45
Inspired by Symfony’s twig extension to fetch output from external controllers and URL’s in their Twig subsystem, I wrote this small Twig function which you can use in your general twig templates. The main purpose of this extension is to fetch external URL (via GET or POST). You can also pass an arbitrary number of... Read More in A helpful Twig extension – Fetch
Categorieën: Open Source, PHP Community

Will Encryption Catch on With Keybase?

Planet-PHP - za, 22/03/2014 - 08:14

Email is not secure. Let’s stop fooling ourselves. Just because I use Gmail, and I’m using it over HTTPS does not mean that the email I send or receive is encrypted while being transmitted outside of Google’s network. Inside Google’s network, even, the contents are not encrypted.1 So, why do we keep sending sensitive information through email, and why do our banks and mortgage brokers and HR departments keep asking for us to send our Social Security number, bank accounts, and other private details through email?

Is it because we are oblivious, naïve, or do we just not care? I suspect it’s a little of all three, but mainly it’s because encryption is hard, and the difficulty barrier keeps us from adopting it.

The alpha launch of Keybase has got me excited. It uses the public-key cryptography (a.k.a. PGP/GnuPG) model to identify yourself, prove your identity, and allow others to vouch for your identity. I hope it paves the way to making encryption easier for us all, from the technologically-skilled to the technologically-challenged.

How Public-key Encryption Works

I want people to send me sensitive information, but I don’t want anyone else to read it while the information is traveling across the Internet. So, I create a pair of keys. One is public; I can send it to others. One is private; I should keep it secret and safe, like the most secret password I’ve ever had.

I give my public key to someone who wants to send me sensitive information, like a Social Security number. They encrypt a file using my public key and send the encrypted file to me. I can decrypt it, since I have the private key that’s paired with the public key used to encrypt the file. I’m the only one in the world who can read the file, and that’s great because I was the intended recipient.

Here’s what’s important: even if someone intercepts the file, they cannot read it because they do not have the private key to decrypt the message. Even if they have my public key, they cannot decrypt it. The information is safe!

A second benefit of encryption is that I can sign my messages to other people, using my private key. If the recipient has my public key, they can verify the signature. If the signature is bogus, they know I didn’t send the message, but if it checks out, they can be certain I sent the message. No one can forge my signature. Using the signature ensures the message hasn’t been tampered with and the recipient hasn’t been fooled into thinking they’ve received a message from me that is really spam (or worse).

A third benefit is the web of trust. Others may validate my public key by signing it with their own key. These signatures are then added to public key servers as additional proofs that the keys in question do, in fact, belong to their real owners. This helps others know whether a signed message from me is actually coming from the real me and not just someone claiming to be me with a false key. The web of trust is decentralized, with key servers around the world.

Encryption Is Hard

While encryption provides massive benefits, it is difficult even for seasoned technologists to perform, much less everyone else. This is because the tools we use for encryption often require basic knowledge of how encryption works. Command line tools and mail and browser plugins may be used to encrypt and decrypt messages using your public/private key pair, but these tools are all afterthoughts, things that must be installed and maintained by a user who knows what they are doing.

In order to gain mass adoption of encryption, it needs to be made central to the applications and platforms we use, and we need the ability to use it easily without fully understanding it. It needs to just work.

How Keybase Fits In

I think Keybase is taking steps toward making encryption work for everyone. Keybase is like a key server with much more. I’m excited about what it could become and what it means for the technology community.

With the alpha launch, here are a few of the things Keybase prov

Truncated by Planet PHP, read more at the original (another 4364 bytes)

Categorieën: Open Source, PHP Community

ServerGrove Blog: Composer 101

PHPDeveloper.org - vr, 21/03/2014 - 19:14

You might have heard about Composer but aren't quite sure what all the fuss is about it. In this new tutorial on the ServerGrove blog, they introduce you to it, help you get it installed and show how it can help you make dependency management simpler.

Composer is a tool for dependency management in PHP. It allows us to declare the libraries (packages from now on) on which our project depends on and downloads them for us. With many high quality packages available to us, the are redefining they way we are building PHP software. You can browse through the wide variety of packages at the composer main repository packagist.org. Composer is a simple tool to use and this tutorial will go over the installation and usage basics.

They walk you through the installation (or either *nix or Windows) and help you get started with your first "composer.json" configuration file. They talk about "composer.lock" and the role it plays and how Composer uses is (and the json version) to pull in dependencies for your libraries of choice. The article also briefly covers the "composer" command and the options it provides.

Link: http://blog.servergrove.com/2014/03/19/composer-tutorial/

Community News: Weca.mp Announced

PHPDeveloper.org - vr, 21/03/2014 - 18:33

A new PHP-oriented conference has been announce, but this one has a bit of a twist. Weca.mp is taking place on an island and, instead of passively listening to speakers, attendees will "develop awesome stuff" with PHP.

WeCamp is a new event focusing on not just hearing about cool technology, but also applying it. During the 5 days of the event, you'll get to work on a project together with 4 random other people, under the guidance of an experienced coach. Together with your team mates, you'll work on improving both your technical skills while developing on the project as well as your soft-skills in managing the project and communicating with your team members.

The focus of the event is different than the usual conference-goer might be used to. It puts an emphasis on a work/relaxation mix with several activities besides things tech-related. Attendees will share tents ("glamping" style) with others for each evening of this five-day event and several "coaches" will be on hand to help guide activities. If you're interested check out the conference site or just pick up your tickets now - Early Bird is already sold out!

Link: http://weca.mp

Building a Twitter Hashtag Contest – Creating and Counting Tweets

Planet-PHP - vr, 21/03/2014 - 18:00

In the first part of the series, we looked at the various types of contests on Twitter and chose to develop a hashtag contest, as it was one of the most popular types of contest and did not rely on luck. So far we have authenticated our users using the Twitter application. Today we are going to continue by implementing the tweet capabilities for our users.

Continue reading %Building a Twitter Hashtag Contest – Creating and Counting Tweets%

Categorieën: Open Source, PHP Community

Michael Dowling: Favor Hash Lookups Over Array Searches

PHPDeveloper.org - vr, 21/03/2014 - 17:47

Michael Dowling has a recent post to his site comparing the performance of hash lookups versus array searches.

A common programming requirement is to match a string against a set of known strings. For example, let's say you were iterating over the words in a forum post and testing to see if a word is in a list of prohibited words. A common approach to this problem is to create an array of the known prohibited words and then use PHP's in_array() function to test if the string is found in the list. However, there's a simple optimization you can make to significantly improve the performance of the algorithm.

He includes two pieces of sample code - one showing the searching of an array using in_array and the other running an isset to locate a key. He points out that the in_array method is quite a bit slower than the hash (key) lookup and includes a benchmark script to prove it.The results are pretty clear, with the hash lookup coming in about 480% faster than the in_array. He also points out that as the size of the strings you're comparing grows, the performance of in_array drops even more.

Link: http://mtdowling.com/blog/2014/03/17/hash-lookups-over-array-search/

Community News: Facebook Releases the Hack Programming Language

PHPDeveloper.org - vr, 21/03/2014 - 16:03

Yesterday marked a major point in the evolution of PHP and its ecosystem. Facebook released their version of PHP, Hack, based on the work they've been doing with the HHVM (HipHop Virtual Machine) and compiler.

Hack is a programming language for HHVM that interoperates seamlessly with PHP. Hack reconciles the fast development cycle of PHP with the discipline provided by static typing, while adding many features commonly found in other modern programming languages. Hack provides instantaneous type checking via a local server that watches the filesystem. It typically runs in less than 200 milliseconds, making it easy to integrate into your development workflow without introducing a noticeable delay.

One of the key features is that it mixes well with PHP and will feel very familiar for those already used to using PHP. The homepage for the language includes all the details you'll need to get started with it, including an interactive tutorial walking you through some of the basics. Some of the features included in the language are things like type annotations, generics, native collections and lambdas. You can find out more in their official announcement.

Link: http://hacklang.org

Community News: Packagist Latest Releases for 03.21.2014

PHPDeveloper.org - vr, 21/03/2014 - 15:03
Recent releases from the Packagist:

June 2014

Planet-PHP - vr, 21/03/2014 - 02:01
Functional PHP
Presented By
Larry Garfield

June 19, 2014 TIME

The post June 2014 appeared first on Nomad PHP.

Categorieën: Open Source, PHP Community

June 2014 – EU

Planet-PHP - vr, 21/03/2014 - 02:01
12 Reasons Your API Sucks
Presented By
Keith Casey

June 19, 2014 20:00 CEST

The post June 2014 – EU appeared first on Nomad PHP.

Categorieën: Open Source, PHP Community

SitePoint PHP Blog: CMS Showdown: Nginx, Ghost, PHP and Phalcon

PHPDeveloper.org - do, 20/03/2014 - 19:58

On the SitePoint PHP blog today Bruno Skvorc has written up the first part of his look at installing Ghost with Nginx and Phalcon on his hosting provider. This is the first post in his "showdown" series of trials on various CMS systems.

You might be wondering why I'm writing about Ghost on a PHP oriented channel - this series will be a showdown of all the various PHP based CMS' I can find, benchmarked against each other and against Ghost, as I look for the next best alternative. Since my DigitalOcean droplet already runs Nginx as a reverse proxy for the blog, I'll also be deploying all the CMS' on that same installation, each on its own subdomain.

He walks you through the whole process from start to finish:

  • Installing PHP on Nginx
  • Setting up a virtual host on a subdomain
  • Installing Phalcon
Link: http://www.sitepoint.com/cms-showdown-nginx-ghost-php-phalcon

Master Zend Framework:Simplifying Unit Testing (and asking for help when needed)

PHPDeveloper.org - do, 20/03/2014 - 18:54

On Matthew Ssetter's "Master Zend Framework" blog today he talks about simplifying unit testing and some of his experience with getting too complicated in his own testing practices.

Recently I was a bit stuck, trying to figure out how to test a section of an application I've been developing. Specifically, I was trying to mock a HydratingResultSet in a controller test, so it could be the return value of a method call on a datasource, my controller needed. I was sure it was the right approach to help ensure the functionality in question was working properly. But no matter what I tried, my tests didn't work, because I wasn't mocking it correctly. [...] I asked for help [on IRC], laying out the problem as I saw it. The first response which came back, from Ocramius, stopped me dead in my tracks: "Why are you trying to do that?"

He includes a bit of background on what he was trying to test and the functionality around it and how, when he stopped to think about it, wondered why he was testing it too. He talks about the refactor he made to his code with a positive end result - the tests now passed. He suggests a few questions to ask yourself when writing your tests such as "am I doing too much?" or "am I testing code in the right place?" Chances are, if you step back and really look at what you're testing, you might realize that the answer to these questions is just to simplify.

He finishes the post with a few suggestions, some of his own personal favorites, of places you can go for help when questions do pop up. He points out that the usual excuses shouldn't be a blocker on asking for help. He is "encouraging you to set your pride, ego and excuses aside and when you're stuck: ask for help."

Link: http://www.masterzendframework.com/people/right-approach-unit-testing-asking-help

The PHP.cc Blog: Disintegration Testing

PHPDeveloper.org - do, 20/03/2014 - 17:20

In this new post on thePHP.cc blog today Sebastian Bergmann relates the unfortunate disintegration of the Mars Climate Orbiter (back in 1999) back to a lesson on software testing and errors.

One of the most important tasks in software testing is to find the smallest scope in which a test case can be implemented. The smaller the scope in which a test is run, the faster it can be executed and the more precise its result. Unit Tests exercise one unit of code in isolation from all collaborators. Integration Tests verify the interaction of two or more collaborators in isolation from the rest of the system. Edge-to-Edge Tests run the software as end-to-end as possible in a single process (and without using a web browser or a web server). End-to-End Tests, or System Tests, look at the whole system and in the case of a web application send a HTTP request from a web browser to a web server running the software to inspect the HTTP response that is sent back.

He talks some about the difference between unit tests and acceptance tests and how "easy and seductive" functional tests can be over unit testing. He points out how fragile (and sometimes slow) this can be though, and how their failure only shows a problem and not where it is.

The promise of being able to develop both the business model as well as the software that implements it in an agile fashion should be reason enough for enterprises to invest in a modern, highly decoupled software architecture. And when the members of the software development team communicate well, both among themselves and with the other stakeholders, then there is not much that can really impede the success of the project. Link: http://thephp.cc/viewpoints/blog/2014/03/disintegration-testing

Joshua Thijssen: Dynamic form modification in Symfony2

PHPDeveloper.org - do, 20/03/2014 - 16:42

Joshua Thijssen has a new post to his site looking at a way to dynamically modify forms in a Symfony2-based application. Form handling can be a bit tricky (especially with more complex elements), and modifying them on the fly can be even more difficult.

Sometimes (or actually, a lot of the time), handling forms will go beyond the basics. And even though symfony2 gives you out-of-the-box a really clean way of creating forms, it sometimes just isn't enough. Fortunately, you are not alone in writing forms, and many posts exists with information on how to handle complex forms. In this post, I will try and demonstrate how to create a dynamic form where you can select a city based on the chosen province.

His example lets the user pick their province and then populates the other select with cities in that area. He includes the code for the form to create these two selects and how to pull out the list of provinces to populate the first. He goes through each part of the example code explaining the methods, what they're doing and how a pre-submit event can be used to populate the second list.

Link: https://www.adayinthelifeof.nl/2014/03/19/dynamic-form-modification-in-symfony2

Community News: Packagist Latest Releases for 03.20.2014

PHPDeveloper.org - do, 20/03/2014 - 15:09
Recent releases from the Packagist:

Disintegration Testing

Planet-PHP - do, 20/03/2014 - 09:00
Categorieën: Open Source, PHP Community
Inhoud syndiceren