ServerGrove Year in Review

Thank you for 2013, it was a fantastic year!

We wanted to take a moment and thank everyone who helped make 2013 great. Here is a summary:

1) Our team grew! 2013 welcomed Alex, Raul, Jorge and Adrian. Chemistry is everything and we’ve got it, the ServerGrove family is bigger, stronger, and running smoother than ever! Everyone is working hard to get you some great new products for 2014!

2) It was a good year for wildlife sightings in front of our office. A Florida crocodile, several manatees, a few turtles and an opossum. In case you are wondering, our office is in the center of Coral Gables, FL. so I guess you can call it urban wildlife.

3) We won a prize!  Our control panel won Best B2B Application at the Symfony Live Awards. Yep – that was cool!

4) We sponsored a bunch of conferences to help our community grow. Keep it up, these conferences make our community stronger!

- Madison PHP - http://2013.madisonphpconference.com/
- Los Angeles PHP Meetup - http://laphp.prg/
- Drupal Camp Spain - http://2013.drupalcamp.es/
- Tech Meetup v2013 - http://tech.meetup.uy/
- Symfony Day IT 2013 :: http://symfonyday.it/
- PF Congress :: http://pfcongres.com/
- PHPcon Poland http://www.phpcon.pl/2013/pl/
- deSymfony 2013 http://desymfony.com/
- True North PHP http://truenorthphp.ca/
- PHPNW http://conference.phpnw.org.uk/phpnw13/
- PHP Conference Argentina http://www.phpconference.com.ar/
- Dev Day 2013 http://devday.devisland.com/
- NYC Camp http://nyccamp.org/
- Symfony Live Berlin 2013 http://berlin2013.live.symfony.com/
- Symfony Live Portland 2013 http://live.symfony.com/
- ZFDay.it http://www.zfday.it/
- DC4D #5 http://daycamp4developers.com/
- 2013 South Florida Hack-a-thon http://www.soflophp.org/events/104419222/ 
- Tek13 :: http://tek.phparch.com/
- Drupal Day DF, Mexico :: http://drupaldaydf.drupodcast.com/
- Lone Star PHP :: http://lonestarphp.com/
- PunchoutPHP :: http://punchoutphp.com/
- phpDay Italy 2013 :: http://2013.phpday.it/
- Midwest PHP 2013 :: http://www.midwestphp.org/
- SunshinePHP Developer Conference 2013 :: http://sunshinephp.com/
- PHPBenelux Conference 2013 :: http://conference.phpbenelux.eu/2013/

5) The control panel has some great new features and is now more powerful than ever! Filemanager, database management and much more!

6) We have a new support site and it’s at http://support.servergrove.com.

7) We have a new status page: http://status.servergrove.com/

We have many great new features and services in store for 2014 and we look forward to working with you!
Happy New Year!

diciembre 31 / 2013
Author Kim
Category ServerGrove
Comments No Comments

Talking about HTTP

I spoke at our local PUG about HTTP for the November meet up. The overall goal of the talk was to give an overview of the HTTP protocol to the group and layout some ideas of how developers can leverage it for better application development. It was a fun night with lots of questions and interactions.

One of the more specific points I tried to drive home was how to use  Requests-lines & Response-codes, with few or no headers or content body as viable communications between clients and servers. Request-lines are the commands that a client sends to the server requesting a resource and the responce-code is the answer a server gives back (aka: server status). Knowing how to tweak these can be helpful to minimize bandwidth usage as well as speed up delivery times for users with slow connections. This is especially true for client side applications that use polling techniques that may initiate several request/response cycles in a minute as well as for high traffic websites that need to conserve bandwidth.

One example is a client side application needs to retrieve data from a server asynchronously, but the data is also processed asynchronously. So as a responsible programmer you queue up a task to be taken care by a worker later on & rather than maintaining the connection open and blocking other possible connections. In doing so you return a task ID and a resource where the client side application can check if the task was completed. Your client side application then begins polling the URL sending the request with some standard browser headers. The server side application then possibly responds with a few headers of its own & possibly a JSON body indicating the status of the task. Each round trip is probably a couple  kilobytes. That’s not a lot, right? What if you multiply that by 5 to 10 requests per minute on a task that could take several minutes to complete? This is probably an edge case and not worth considering, right?

What if instead your request looked like this:

HEAD http://www.domain.com/path/to/task/resource HTTP/1.1
task-id: iahsFAGf2akl498lknnZZ09

(oh yeah, x- on custom headers was deprecated).

Then the response could look like the following if the task had not been completed:

HTTP/1.1 100 Continue

Now you’re talking about probably less than a kilobyte, maybe in the low hundred bytes for the total size of the round trip.

This is not possible at the moment as there is no way for the client side application to tell most browsers to turn off standard headers. However, you do have some control over what the server sends as the response and you can minimize the amount of data sent back.

In Nginx, you can clear most, if not all, headers through the Http Headers More Module:

more_clear_headers 'Content-Type';
more_clear_headers 'Content-Length';

The HTTP specification actually says that some of these headers SHOULD be returned with the response and Apache has decided to treat this specification as “always must”. Which means that with a few workarounds you can still shave off about 100 bytes on a response that has no content body.

Start by doing things that are considered security best practices anyways. For example setting the Server header to be the least verbose. Add the following to your main Apache configuration:

ServerTokens ProductOnly
ServerSignature Off

This will remove most of the serer signature and leave only the product name, Apache.

While you’re at it, you should do the same for the x-powered-by header added by PHP.Change expose_php to the following in your php.ini

expose_php = off

These are considered security best practices because by removing the version numbers of the technologies you’re using, you are not advertising which security vulnerabilities you have not patched yet. This will also remove about 60 bytes from the headers.

Beyond that you can use PHP’s header() and header_remove() functions to set and remove custom headers. By default, if no content is sent back, the default headers from Apache are about 300 bytes and you can shave off about 100 by doing what’s mentioned above. In the end it’s the responsability of the application to set headers and content only when absolutely necessary and to use the status codes when appropriate

Looking into the future we must mention SPDY. SPDY is an experimental communications protocol which may possibly be a large part of the next version of HTTP. To give you an idea of what SPDY is looking to accomplish, these are the goals from the project website:

  • To allow many concurrent HTTP requests to run across a single TCP session.

  • To reduce the bandwidth currently used by HTTP by compressing headers and eliminating unnecessary headers.

  • To define a protocol that is easy to implement and server-efficient. We hope to reduce the complexity of HTTP by cutting down on edge cases and defining easily parsed message formats.

  • To make SSL the underlying transport protocol, for better security and compatibility with existing network infrastructure. Although SSL does introduce a latency penalty, we believe that the long-term future of the web depends on a secure network connection. In addition, the use of SSL is necessary to ensure that communication across existing proxies is not broken.

  • To enable the server to initiate communications with the client and push data to the client whenever possible.

This is both incredibly exciting and terrifying. Exciting because we’re witnesses/contributors to the evolution of a technology. Terrifying because of the implications this may have on existing applications.

I don’t fully agree with everything the project is trying to accomplish. For example making SSL the “underlying transport protocol” for everything is overkill for a lot of websites that are serving up static content (think your average WordPress site). However, some things like header compression & concurrent connections if they’re opt-in could lead to exciting new ways of writing client side applications.

The possibilities are endless and I only hope that I was able to give the members of our local group a means with which learn more about HTTP.

diciembre 16 / 2013
Author Adrian Cardenas
Category PHP
Comments No Comments

Call us award winning

award

Like many developers and designers who work years on a product, we end up only seeing what can be made better, that’s what keeps us going, we need to make it “perfect”, but once in a while it’s nice to be able to look at it with fresh eyes. Everyone here at ServerGrove was humbled and extremely excited about winning this years Symfony Awards for Best B2B Website. Everyone except Pablo, who is excited, humbled and kicking himself for missing his first SymfonyCon in years and not being there to accept the award. Warsaw: it looked  fun.

We would like to thank the judges at SymfonyCon Warsaw for the award.

We would also like to thank our customers, really, it would not have been possible without you. The control panel was built based on feedback and suggestions from our customer base. Improvements and tweaks were a direct result of the constant feedback provided by users. Keep it up! We like to hear from you :)

None of this would have been possible without our incredible team! It’s an honor to work with such a talented group of people who make us want to be better at what we do every day.

Finally we would like to thank the Symfony community. You guys are awesome. Symfony is awesome!

What’s next?

I write this as we are deep into development of our third version of the control panel, and there are some exciting things on the way. We might as well take this opportunity to share a few things coming down the pipeline:

- The front end is being re-written in AngularJS as a Single Page Application and will be released open source. It will blow your mind away!

- The API is being rewritten using the RestBundle for full REST compatibility. It will also support OAuth authentication.

- Persistent terminal, filemanager and log files that are available from any part of the control panel.

- The new filemanager is freaking incredible.

- The new control panel will work on other hosting providers, not just ServerGrove.

- Of course it’s responsive.

There are also a ton of tweaks and optimisations: faster, better, and fun to use. Stay tuned!

 

Photo credit:@danielcsgomes
 

diciembre 13 / 2013
Author Kim
Comments 1 Comment

2014 PHP conferences

Just a quick note to let you know of a few awesome PHP conferences coming up early 2014. Conferences are a great place to update your skills, stay current with what’s happening in the community and just have fun. In addition, these first quarter conferences allow you to have some awesome mixins like php+beach or php+ski. It does not get better than that! Here is what we have on the schedule for early 2014

SkiPHP

Salt Lake City, Utah from January 17th – 18th, 2014
https://www.skiphp.com/

SkiPHPSkiPHP is a new conference organized by some great folks in the  Utah PHP Users Group. We have no doubt that this will become on of the great conferences of the West. Drink Utah beer, Ski Utah powder, break a leg, learn some PHP, what else could you want?

PHP Benelux

Antwerp, Belgium from January 24th – 25th, 2014
http://conference.phpbenelux.eu/2014/

benePHP Benelux is the undisputed PHP geek stronghold of northern Europe. Some of the best speakers in the world come together once a year to give their talks. The conference is only 5 years old, but we all agree it’s one of the best conferences of the year. And it is an excellent excuse to eat Belgium fries and chocolate, and taste the amazing Belgium beers! Don’t miss it!

Sunshine PHP

Miami, Florida from February 6th – 8th, 2014
http://2014.sunshinephp.com/

sunshinephp_logo_2014_200pxThis conference is organized by the South Florida PHP User Group and is a BLAST! With one of the most competitive CFP’s around (yes, everybody wants to come to Florida in Feb.), last year’s conference was top notch bringing some of the best speakers from around the world for two days packed with PHP nerdness. And this year there will be a full tutorial day prior to the conference, plus a full track of unconference talks.

PHP UK Conference

The Brewery, London from February 21st – 22nd 2014
http://phpconference.co.uk/

ukIt’s always a good sign when a PHP conference is held at a brewery. It’s the 9th annual edition of this quality PHP conference. It has three tracks and over 30 speakers.

Confoo.ca

Montreal, Canada from February 24th -28th, 2014
http://confoo.ca/en

confooHuge conference with a giant diversity of content, Confoo does not focus on PHP exclusively but has a good number of PHP related talks. People are friendly and it’s always a lot of fun.

SymfonyDay Portugal

Auditório Microsoft Portugal, Portugal from March 7th -8th, 2014
http://www.symfonyday.pt/2014

confooThe SymfonyDay Portugal is a non-profit Conference about Symfony and PHP from the community for the community.

PHP North East

Tyneside Cinema, Newcastle upon Tyne, March 18th, 2014
http://conference.phpne.org.uk/

confooPHP North East Conference 2014 is a one day event held in the stylish and beautiful Tyneside Cinema. Sit in comfort and have your mind blown as our passionate speakers talk about the latest libraries, tools and practices instrumental in shaping the future of PHP development.

Midwest PHP

University of Saint Thomas Minneapolis, MN from March 15th-16th, 2014
http://midwestphp.org/

mwLast year MidwestPHP won the prize for the coldest PHP conference in the world, but that did not scare over 200 attendees from showing up and supporting their community. This year will also include a training session by php[architect] and an incredible speaker lineup.

PHP Code Craft South Africa

Johannesburg, South Africa, April 4th, 5th, and 12th, 2014
http://www.phpsouthafrica.com/

phpcraftTheir first conference was held recently in Cape Town. It was a sold out affair with over 120 attendees from throughout Africa. After their first successful conference in Cape Town they got a bunch of requests from devs in Johannesburg and they decided to hold a second, bigger conference there. Check out their website, it includes a ton of photos and videos from the past conference.

Drupal Mexico City

Universidad Nacional Autónoma de México (UNAM), from April 23rd-25th, 2014
http://drupalcamp.mx/phpcraft

Organized by Indava, an information technologies consultant where which uses Drupal to create high-quality solutions for their clients.

Lonestar PHP

Addison Conference Center in Addison, TX from April 25th -26th, 2014
http://lonestarphp.com/

lonestarphp-logoWelcome back to Lone Star PHP for another great year! This is their fourth year and they’re making things better all the time. This year’s event will provide all of the great PHP speakers and content you’ve come to expect from Lone Star PHP. There’ll be plenty of time to spend with the local PHP community too through after-parties and other events.

PHP Istanbul

Bahcesehir University Besiktas Campus on May 3rd, 2014 – Istanbul, Turkey
http://phpist.org./

lonestarphp-logoThis is the second php-ist event, a one-day conference about the latest developments and cutting edge techologies in the php world.

OpenWest

Utah Valley University, from May 8th-10th, 2014
http://www.openwest.org/

tekUtah Open Source Foundation, a collaboration of volunteers from local user groups, held its first conference in 2006 to support and promote open-source software. The conference has grown since then, and so has its regional reach into the surrounding communities.
By 2012 they welcomed hundreds of participants from states throughout the Mountain West. They  celebrate the 2013 Utah Open Source Conference by expanding it into a regional event, the first annual OpenWest Conference.

World Camp Miami

Coral Gables, Miami from May 9th-11th, 2014
http://2014.miami.wordcamp.org/

WordCamp is a conference that focuses on everything WordPress. WordCamps are informal, community-organized events that are put together by WordPress users like you. Everyone from casual users to core developers participate, share ideas, and get to know each other. WordCamps are open to any kind of WordPress user in addition to those interested in social media, front-end development, and learning how to become a better freelancer.

Laracontek

Scholastic Event Center Auditorium, New York City, from May 15th-16th, 2014
https://conference.laravel.com/

Laravel Conference

PHP Day Italy

Verona, Italy, From May 16th to 17th, 2014
http://2014.phpday.it/

logo_phpday (1)This is one of our all-time favorite conferences to go to. Great speakers, great food, great city, and fun Italian PHPers. What is there not to like? Nothing. The organizers really put in a lot of effort in making this conference awesome and it shows. The Italian government could learn a few tricks from these guys on how to organize things :) Their call for papers is still open, make sure to send yours in, this is a conference not to be missed.

Did we miss your conference? Just email us at sales@servergrove.com and we will add your conference to the list.

DrupalCamp Spain 2014

Valencia, Spain, From May 16th to 18th, 2014
http://2014.drupalcamp.es/

logo_phpday (1)

DrupalCamp.es is the biggest annual event organized by and for lovers of Drupal in Spain. Drupal is free open source software and international community.

PHPTek

Chicago, from May 19th-23rd, 2014
http://tek.phparch.com/

tekphp[architect] and musketeers.me joined forces last year and this will be their second php[tek] conference together. The conference was already good but they are promising “bigger, brighter, and full of loads of great content” (can it get better?).

CraftingCode

18 cities, 15 states, 3 countries, from June 11th-July 12th, 2014
http://www.craftingcodetour.com/

tekWriting great, high quality code is hard. Understanding the nuances of the languages you use, and the way in which you accomplish certain tasks can be highly challenging. That’s why The Crafting Code Tour is coming to a city near you in Summer of 2014. And the best part? Attending is completely free!

JoomlaDay.MN

Aloft Hotel in Minneapolis, Minnesota – July 19th, 2014
http://joomladay.mn/

tek

This year Minnesota will play host to not only the MLB all-star weekend in mid July, that’s right Joomla Day MN has finally arrived! If you’ve enjoyed hearing the speakers and meeting other Joomla! people from other events, now is your chance to interact with them in person. We promise, no snow.

PHP New Zealand

Victoria Business School, Wellington, New Zealand., from August 27th-29thtek. 2014
http://www.phpconference.co.nz/

New Zealand PHP Conference 2014 will be two days of conference with awesome sessions along with one additional day of PHP training and lots of opportunities to meet and greet with developers from all New Zealand. With 200+ attendees including notable speakers from the global PHP community the event will focus on sharing knowledge and networking with peers.
Being the first PHP Conference in New Zealand, it is expected to be attended by top talent in the PHP & surrounding communities, companies and project representatives from all around New Zealand and Australia. Prominent international speakers have been confirmed to address the conference theme and we are regularly receiving new propossal and confirmations.

TRUCEConf

Cincinnati, September 2014
http://tek.phparch.com/

TRUCEConf is a two-day conference, taking place in September, 2014. The goal is to help the tech community heal, through learning from others outside our industry and having an open dialogue and on how we can be better humans to each other in the world of tech. TRUCE stands for trust, respect, unity, compassion, and equality, and we’ll be working together in an open and safe environment to shift our culture in this direction.

noviembre 04 / 2013
Author Kim
Category Conferences
Comments No Comments

Symfony2 components overview: EventDispatcher

This week, in the Symfony2 components overview series, it’s time to talk about another really important component: the EventDispatcher.

2812073310_38ee1db2ce_o

Event listeners are like ninja cats. You can’t see them, but they are there waiting for the signal $event to come

The EventDispatcher component

For many years, in the PHP world we were used to code following a linear flow, where instructions were executed one after another, jumping to functions or methods. Events change the way we design our software and allow us to decouple different parts creating small and reusable classes with a well-defined goal.

For example, imagine you have a blog system and want to send an email to all users when a new blog post is published. Following the events approach, you would create a class responsible for sending out the emails which listens the made up ‘blog.post.saved’ event.

Mediator pattern

Basically, the Mediator pattern decouples a Producer from a Consumer. As communication between objects is encapsulated with a mediator object, they no longer communicate directly with each other, but instead through the mediator.

Mediator pattern

The Producer - which in our previous example is the action that inserts the new blog post into the database – does not ask the Consumer to send out the emails. The Producer does not even know there must be sent any email at all. Instead, this is how it works:

  • The consumer says: “Hi Mediator, please inform me when a new blog post is persisted in the database”.
  • Other two consumers also want to know when a new blog post has been published. The first one wants to regenerate the RSS feed and the second one wants to send the pingbacks to notify the authors of all the cited posts. So both ask the Mediator to inform them as soon as a new blog post is persisted.
  • Finally, a new post is created, so the producer says: “Hi Mediator, I just inserted a new blog post into the database, let others know!”.
  • The Mediator informs all the listeners of the event according to priority.

As you can see, both producer and consumers don’t even know about other’s existence. They are decoupled and any consumer can be disabled without affecting the program.

Simple example

This is a simple example to explain the basic functionality of the EventDispatcher component:

use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\Event;

$dispatcher = new EventDispatcher();

// add listeners
$dispatcher->addListener('blog.post.saved', function (BlogPostEvent $event) {
    echo 'Updating RSS feed' . PHP_EOL;
});
$dispatcher->addListener('blog.post.saved', function (BlogPostEvent $event) {
    echo 'Sending emails' . PHP_EOL;
});

$blogPost = new BlogPost(...);
$manager = new Manager(...);

$manager->save($blogPost);

// dispatch the event
$event = new BlogPostEvent($blogPost);
$dispatcher->dispatch('blog.post.saved');

The above example defines two listeners using anonymous functions, one for updating the RSS feed and the other one to send the emails. We used PHP anonymous functions to simplify the example, but any PHP callable may be passed. The functions receive one parameter – BlogPostEvent $event -, which provides the dispatcher object – useful for event chaining - and the event name. The class BlogPostEvent is a custom class which extends from Symfony\Component\EventDispatcher\Event allowing the listener to get the newly created blog post.

Once we defined the two listeners, our example creates the blog post object and saves it into the database using a manager. This depends on your application and it is not important for the example. Then, an event object is created and dispatched so all the listeners are informed.

The output, as expected, is:

Updating RSS feed
Sending emails

This is the moment you should start realizing how powerful events are. If tomorrow your client wants to send a tweet automatically every time a blog post is published, it will be as easy as create the class to do the actual tweeting and add the listener, without messing around with the current code. This is the magic of decoupling!

Event listeners vs Event subscribers

There is another way to listen to events using event subscribers. An event subscriber is a class that implements the EventSubscriberInterface interface and is able to define which events is going to be subscribed to.

namespace ServerGrove\BlogBundle\Event;

use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;

class BlogPostSubscriber implements EventSubscriberInterface
{
    public static function getSubscribedEvents()
    {
        return array(
            'blog.post.saved' => array(
                array('updateRss', 10),
                array('sendEmails', 5)
            )
        );
    }

    public function updateRss(BlogPostEvent $event)
    {
        // ...
    }

    public function sendEmails(BlogPostEvent $event)
    {
        // ...
    }
}

The BlogPostSubscriber class tells the dispatcher that it will listen to ‘blog.post.saved’ events, executing first updateRss – it has more priority, 10 vs 5 – and then sendEmails.

To register the subscriber:

$subscriber = new BlogPostSubscriber();
$dispatcher->addSubscriber($subscriber);

Performance

The little overhead added by the dispatcher object pays by itself as the decoupling makes it really easy to add or remove features. Anyway, three aspects must be taken into account when using events to keep them under control:

  • Be specific: It really depends on your application, but as a general rule, be as much specific as possible. For example, don’t use the same event for saving posts and comments.
  • Early return: Sometimes, listeners must be executed only if some requirements are fulfilled. For example, if emails only have to be sent if the blog post has the tag ‘symfony’, must be checked as soon as possible, especially if the event is too generic and gets called often:
    $dispatcher->addListener('blog.post.saved', function (BlogPostEvent $event) {
        if (!$event->getBlogPost()->hasTag('symfony')) {
            return;
        }
    
        // send emails
        // ...
    });
    
  • Stop propagation: If there are several listeners for the same event, one of them can prevent any other listeners from being called:
    $dispatcher->addListener('blog.post.saved', function (BlogPostEvent $event) {
        $event->stopPropagation();
    });
    

Who’s using it

More info

Photo: Ama-gat / Ninja cat, by Xavi

octubre 23 / 2013
Author Raul Fraile
Category PHP, Symfony
Comments 6 Comments