Servage Magazine

Information about YOUR hosting company – where we give you a clear picture of what we think and do!

Archive for December, 2016

PSR coding-standards for PHP

Wednesday, December 28th, 2016 by Servage
phpWhen PHP 1.0 was released in 1995, there were no common standards or code style preference for the language.  This continued to be the case until 2009 when PHP PSR (PHP standard recommendation), a set of standards was finally introduced to the language. The recommendations consist of multiple standards, so let's see what the major ones are. PSR-1: Basic Coding Standard The basic coding standard defines a set of rules that all PHP files should follow. The purpose of it is to make shared PHP code as compatible as possible with other projects and environments where the code is executed. For example, you should only use the full <?php or short-hand <?= tags in ...

Introduction to WebSockets

Wednesday, December 21st, 2016 by Servage
WebSocketsDid you know it is possible to build real-time applications using only PHP? This is possible, thanks to a protocol called WebSocket. WebSockets allow a client and server to remain connected and exchange data in both directions without having to reload a web page. It does not matter whether you are a front-end or back-end developer since WebSockets are available in HTML5, JavaScript, PHP and many more languages and platforms. How WebSockets work WebSockets use the TCP protocol on port 80, which is the same port HTTP uses. By definition, WebSocket is a full-duplex protocol, meaning both ends of the connection can talk at the same time without interrupting each other. But how ...

Automating testing with continuous integration

Friday, December 16th, 2016 by Servage
Continous-IntegrationIf you are writing tests for your application or your application must be prepared for release each time a new version is created, you should be using continuous integration (CI). It allows you to automate both of these processes by triggering them whenever you want, such as when you push a commit to a Git repository. Continuous integration can save you a lot of development time, and this is how you can get started. Why Continuous Integration? If your application is still in development, probably the biggest advantage in CI is the ability to automatically run tests for new features. You can also use it to build your application from source code into ...

Advanced HTTP methods explained

Sunday, December 11th, 2016 by Servage
http-methodsGET and POST requests are the most common HTTP methods, but these are not the only ones you can use in your applications. You may have heard about PUT, PATCH and HEAD, and if you are working on an RESTful API, you should be using them. Let’s see what these less common HTTP methods are and when you should use them. PUT Request When speaking from a RESTful viewpoint, a POST request is used to create a new resource. When a resource has already been created, it can be updated with a PUT request. PUT replaces the entire resource, so you you are essentially recreating it when using a PUT request. This means you ...

Useful LESS functions you should know

Wednesday, December 7th, 2016 by Servage
lessLESS is a CSS preprocessor that extends vanilla CSS by adding many features, such as variables, functions and mixins, to the language. This time we will focus on the functions LESS provides. Here are some common ones you may find useful if you use LESS in your projects. Image Functions Have you ever come across a scenario where you need to know the dimensions of an image inside a CSS style sheet? LESS is smart enough to do this for you. To find out how large an image is, you can use the image-size function. image-size(“/path/to/file.jpg”) will return the dimensions of the image, for example “250px 200px”. You can then apply these directly ...

Working with acceptance testing

Saturday, December 3rd, 2016 by Servage
AcceptanceTestingSoftware testing is important, and hopefully all developers agree with it. Finding a bug at an early stage is much easier and cost-effective to solve than letting it go unnoticed for a long time. But how does testing a web application work? Let's look into one way to do it: Acceptance Testing. Acceptance Testing explained Acceptance testing means the process of testing that an application works as it should. In a web application it works by clicking buttons, submitting forms and tweaking settings. Acceptance testing is usually the last step of testing. If you have different types of tests, you usually run unit and functional tests before acceptance tests. In acceptance testing, the tester ...