Matheus Marabesi website, sharing ideas about software development - Listing posts on page 8

Running PHP with Arduino

Lately I’e been playing with Arduino and PHP to create simple demos and see how the interaction between them works. For my surprise it worked really well and I could at least do the blink example with few lines of code. From now on I’ assuming that you’e played around with Arduino and feel familiar with some terms like, execution loop, setup, pins and LED. I used Arduino Uno to keep the things as simple as possible, but any Arduino family board is supported. Understanding a bit of streams The first thing that came to my mind at least was...

Laration - A simple way to visualize your configs

Some times during our development work we need to check wether a config has been defined, and in most of the times we just jump to the file, which means to seek the file, open it and change it (or just see the value and leave it as it was). Laravel provide us a really simple way to find the configs. This is because Laravel uses the dot file pattern, where the configuration needed will be inside of an .env file in the root of the project. APP_ENV=local APP_KEY=base64:IYCeNxLZFcUKLn6IoeCzKFiW0WmVjt6gU36kCBOfr9A= APP_DEBUG=true APP_LOG_LEVEL=debug APP_URL=http://localhost DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=homestead DB_USERNAME=homestead DB_PASSWORD=secret This solution...

Laravel the right way (PART 2 - Modules) - 10 Laravel meetup

Modules are always required by many applications and its not different in PHP, but again, to take this decision there are things to think about. The first is the size of your application, if you have a small app there is no need for modules since it will increase the amount of code and will bring no advantage. The second thing is how you’ like to organize your app, modules give us the ability to isolate responsibilities and instead of talking with classes only we could do the communication between modules. Unfortunately Laravel doesn’t comes with a modular system, which...

Laravel the right way (PART 1) - 10 Laravel meetup

Recently I’ve been to the Laravel meetup and I had the pleasure to talk about good practices and common mistakes that newbies in Laravel do in the daily basis. We had also Guilherme Guitte’s talk who had spoken how elastic search work. Laravel the right way There are a few topics that I’ve been across over and over during my daily basis as a developer using Laravel. This bothers me because some of them are so easy to understand to use that I decided to divide it in a few topics and try to guide the developers to a better...

9º Laravel Meetup

Recently I’ve been to Laravel meetup in São Paulo hold by iMasters coordinated by Ravan and Zizaco, both working for Leroy Merlin and using Laravel (of course). The meetup started with a really good introduction and interaction between the audience, thanks iMasters for the coffee-break. Usually the people who go to the meetup are known by the hosts. They were really comfortable with each other which I think is really good. The main goal of the meetup was to help newbies in Laravel(specifically in middleware). The first speaker(Igor Carvalho) started his talk. Middleware 4 Life His talk was a really...

Bringing PHP and IoT together

Recently I’ve been around IoT with PHP and I made some small projects such as LED blink, sensor management and so on. Therefore I chose PHP to be my main language to dig into IoT’s world, for my surprise it was a tough decision. Unfortunately we have few libraries written in PHP to deal with I/O and this kind of components, at first it is normal the lack of content because PHP was built to be used in the web, therefore we can make it better. Here I’m going to use PHP to connect with Arduino and turn on a LED....

Requirements Engineering - A tool for Use Case

Recently I’ve finished my MBA in software engineering and as a result my group and I ended up with and tool for use case management. We were aimed to develop something that helps teams build a better software and we founded in requirements a gap to be fill. As usual in Brazil software development is a big issue (I’m specifically talking about Brazil because is my country and where I have experience) with impossible dead lines, crap documentation and bosses even worse. In resume software here is just a matter of money and doesn’t matter if you built it with quality...

S.O.L.I.D - Practices for Object Oriented Programming (code examples in PHP)

Being able to write better is a achievement that every programmer want to. SOLID is a great thing to start to and particularly one of the best things to be followed by TDD. Single responsibility A class should have only a single responsibility (i.e. only one potential change in the software’s specification should be able to affect the specification of the class) [1] [2] [3]. <?php class Upload { private $file; public function __construct($file) { $this->file = $file; } public function validate($data) { // apply validation rules } public function moveFile() { // move file } public function rename() {...

Continuous PHP

Continuous PHP is a amazing CI tool which provides a easy and quick way to run tests and automate deploy, at some point of our application regardless of it’s field you will need a CI server to automate things to you and then comes Continuous PHP. I confess I used travis CI for a long time and jenkins as well but the problem with those tools is that no one is specifically for PHP projects. Jenkins is a great example of that to use with PHP we need to install a couple of plugins, Travis CI is more flexible with...

ZCPE 5.5 here we go – PHP Streams (Files/Http)

PHP has a great section about stream which is not used frequently by developers. Streams as the PHP documentation says: “In its simplest definition, a stream is a resource object which exhibits streamable behavior. That is, it can be read from or written to in a linear fashion” - php.net. In many cases streams are used  unconsciously when handling a file for example. <?php print file_get_contents('http://www.marabesi.com/my_file.php'); Look the code above where we are using the http:// wrapper. Wrapper is what we use to handle a stream in PHP and there are a couple of wrappers in PHP file://, http://,** ftp://,...