Category: php

Two-step verification with php and Google Authenticator

A security feature in system authentication that has become quite popular recently is 2-step verification. The main banking and brokerage applications use their own apps to generate tokens that are dynamic (they are constantly updated in low cycles of time), and used as a 2nd factor for system access (the 1st factor is the traditional username/mail and password ).

However, if you do not want to implement your own token generator, you can use Google Authenticator, an application with the mentioned features (available for Android and IOS) and that can be easily integrated into your application or web system. In this post, I’m going to show you how to integrate your php application with Google Authenticator.

Continue lendo

Guzzle: a HTTP client to php

At a time when interoperability between systems has become increasingly important and the creation/use of APIs is increasingly ascending, it is always important to think about the consumption of third party services within our projects.

In php, although it is relatively simple to make requests “http” with the native resources of the language itself, it is recommended that a library be used for this purpose, since this way we have more security and resources that facilitate and make this process more agile procedure.

Continue lendo

Respect / Relational – the simplest ORM framework for php

Basically all the main programming languages currently have ORM frameworks (Object Relational Mapping), which help a lot the development of applications (under the object orientation paradigm – OOP) that persist in relational databases (like MySQL, Postgre, SQL Server, among others).

The function of an ORM framework is to abstract objects from a database (tables, columns, relationships, and so forth), map them, and make them readable within a project being developed in OOP.

Continue lendo

Composer: how to autoload php classes outside the “vendor”

The Composer (https://getcomposer.org/) is a dependency manager (packages) widely used in language PHP and provides many facilities, since it is responsible for checking, download to engage our project all the “libs” of third parties that we will need.

These “libs”, when downloaded by Composer, are grouped within a directory called “vendor”. In addition, a file called “autoload.php” is also created in this folder, responsible for “loading” all the classes we need to use. Basically, all I have to do is import “autoload.php” into a file of my project and I will have access to all classes of “libs” downloaded by Composer.

Continue lendo