QueryFilter: A Model Filtering Concept

Having a clean code with single responsibility is important, and doing that for model filtering can be easy and very powerful. Believe me.

This blog post is related to a talk I gave on April, 2018 on Darkmira Tour PHP 2018, in Brasília/DF, Brazil, with the same title. The slides are on SpeakerDeck.

Filtering models was, for a very long time, a hard task for me. I admit that I could not think in some easy way to do that. I tried, refactored some code, created custom classes for that, but I never thought how this could be easily implemented.

Watching a Laracast’s video from 2016 about the Laravel’s Eloquent ORM I faced of with a bunch of classes and a trait that removed a lot of trash from my controller actions. That was called by Jeffrey Way the QueryFilter.

Continue reading QueryFilter: A Model Filtering Concept

Congratulations! Now you are a remote worker. Enjoy your new life!

Working remotely is the dream job of most developers I know. It’s a hard process but it’s totally possible. Now you got the best job you could . Enjoy your new life!

The beginning. The dream.

Do you remember yourself some weeks/months ago? The first interview you did (maybe you’re not a native English speaker like me). You’ve improved a lot, you’re a better person. You’re speaking a “better English and you’re not shy “in front of” the interviewers anymore.

After resumes and more resumes, after those initial interviews, those technical ones, after doing a “sample project” to show up your skills, you got your dream job. You received an offer and you accepted it. Now you’re officially a remote worker! Congratulations to you and to your wife, because now you’re going to be at home every day, and this is really important!

Now you can work from anywhere, even traveling. Now you can be a digital nomad. Now you can work without pants, with slippers and you can wake up just a few minutes before start working. No more commuting, no more offices.

Next week you’re going to start a new step in your life. Be prepared, because your life’s going to start changing forever. I said forever.

Continue reading Congratulations! Now you are a remote worker. Enjoy your new life!

Open-source is about sharing and giving back. Think about that.

Maintaining an open source project – even a small one – is not an easy task. The open source ecosystem is about sharing and contributing, about giving and receiving. You scratch my back and I will scratch yours.

Open-source is not only a free and open software, it’s a lifestyle. Working with open-source is working for free, making the other’s life better. It’s like someone that works helping people through an NGO (Non-Governmental Organization). They do the better expecting nothing back.

According to the Oxford Dictionary open-source is “Denoting software for which the original source code is made freely available and may be redistributed and modified”. Pay attention to these two words: redistributed and modified. This means that you can change the original code, can update it to your needs, and can share it back to the community. Remember this.

Continue reading Open-source is about sharing and giving back. Think about that.

Degree or not degree? When is it really important?

One of the most discussed topics in the technology field is about having degrees and how important they are. Do you really need one to be a good engineer? When is it really important for you?

Writing a post like this is a big responsibility. I’m not here to say if you should attend to a university degree, even the opposite. I’m here to share my experience and make you think about this subject with at least two different points of view. Since 2016 I’m on the employee side of the desk, but I stayed on the employer one for nine years, including hiring.

Continue reading Degree or not degree? When is it really important?

Easy server provision for PHP environments using ServerPilot

Learn how to use a very simple and efficient service called ServerPilot for provisioning a web server to host your next PHP project or blog.

Provisioning a well-configured web server for a PHP application is not an easy task. You can have experience doing that, but this is not my strongest skill, I admit. So I’m always looking for new services and tools to make this job easier for me, and faster.

I’m a big fan of Laravel Forge and the company I run for years was (and is) a very happy Forge customer. Unfortunately, my goal, for now, was to find a place to host my blog, after some changes I’ve made in the last weeks.

I run my blog using Jekyll and GitHub Pages for years, but I was writing less then I expect. I like the WordPress platform, and mainly writing on its editor, so I decided to move back to WP. Then I create a new droplet on DigitalOcean using their LAMP box. The droplet was running well, but sometimes Apache could not handle everything well, then I needed to add an NGINX reverse-proxy to make things easier. There’s when I discovered ServerPilot.

Continue reading Easy server provision for PHP environments using ServerPilot

Invest in yourself. Be searchable!

Being really good in your field is important, but more important than that is to seem to be good. Invest in yourself. Be searchable!

How many times did you search your name on Google? How many times did you search some keywords related to you? Did you like the results you got? Can them be better? They should.

We, developers and engineers, built the Web like it is today, but sometimes we forgot how important we are, and mainly, how important we should be. This is something that – believe me – happens more than you think. We like to code for others, to create software, to make money, but we forget to invest in ourselves images, and how people think we are.

This is not about your work, this is not about your job. This is about you, your image, and how you take care of it.

Continue reading Invest in yourself. Be searchable!

Why you should contribute to open source projects

Open source can change your life. It has changed mine with Corcel, an open source project I started in 2013 that changed who I am, and how I live.

The first title I gave to this post was How open source can change your life for the better. That was a good title too, but I think the main reason I wrote this post is to encourage you to start (or continue) working and contributing to open source projects, that’s why the title changed.

You can think: “open source cannot give me any money”. The fact is: directly no, maybe a few. Contributing to (or creating) open source projects show your code to the world. And that’s the point! It’s when your life starts changing, believe me.

My life started changing in 2013, and because of open source. In that year I was running my company, an advertising agency. I was the one responsible for all the web and development fields. Actually, the company started in 2007 and I was in the heart of the development team for many years.

Continue reading Why you should contribute to open source projects

Using XDebug with PHPUnit in PHPStorm

Learn how to configure XDebug and PHPUnit in PHPStorm, allowing you to write better tests and fix bugs faster.

Test Driven Development (TDD) is an old topic, I know, but it seems many people don’t understand how it makes you write better code. The point here is that one of the most important benefits it’s to use debugging tools together with tests, making your flow more efficient.

I started using TDD on the command line, and still use it sometimes, but since I started using PHPStorm and decided to try how it handles tests, and that’s amazing! When you add debugging tools – like XDebug – to it everything starts making sense, then you have the feeling you’re on the right path.

PHPStorm has a dedicated interface to run and debug tests, almost in the same window, what makes the process of writing code safer and easier.

Continue reading Using XDebug with PHPUnit in PHPStorm

Using Ruby on Rails Ajax adapter with any project, even PHP (like Laravel)

Hello!!!

Every project you have to make some requests using Ajax, right? I know that jQuery has done a very good job and almost all project you start it is present there, together with your Javascript files. So you can make Ajax calls any time, where you want, just making the call using Javascript.

I developed some projects using Ruby On Rails some time ago, and I start to think about using AJAX in a different way. Rails uses a custom jQuery adapter to allow you to do things like that:

link_to("Destroy", user_path(@user), method: :delete, remote: true)

Continue reading Using Ruby on Rails Ajax adapter with any project, even PHP (like Laravel)

Why WordPress is your best option for creating websites

Hi everybody!

Here I’m again to write my first post in 2015. Last year I’ve wrote less and this year I have plans to write much more, telling about my experience with web development. I have plans to start screencasting too, but this is just plans 😀

I decided to start this year writing about WordPress. Last year I thought WordPress helped me and my company to develop websites faster with a bunch of nice features, making a better job and with less time I spent before.

So, today I’m starting a series about using WordPress to create websites. First I’m going to write about why you should use WordPress to develop your next website and after how you can do that, which plugins you can use and how to use them, one by one.

Continue reading Why WordPress is your best option for creating websites