Laravel is a PHP framework that uses Eloquent, a powerful and amazing ORM that allows you to do complex SQL queries in a very easy way. But sometimes you need more, and here I’m gonna give you an interesting tip that can bring you a lot of flexibility. When dealing with simple database queries in … Continue reading Querying and…
Junior Grossi
https://blog.jgrossi.com/ · 52 posts · history since 2011 · active
7 May 2018
30 Apr 2018
Testing with Laravel is very easy, but it can be a nightmare when the tests depend on Events and Listeners. In this post I’m gonna show you how you can simplify and improve those tests. Laravel is one of the most popular PHP frameworks nowadays, and I’d say its Event handler is one of the … Continue reading Solitary or…
23 Apr 2018
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 … Continue reading QueryFilter: A…
2 Apr 2018
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 … Continue reading Congratulations!…
26 Mar 2018
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 … Continue reading Open-source is…
19 Mar 2018
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 … Continue reading Degree or…
12 Mar 2018
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 … Continue reading Easy server…
5 Mar 2018
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 … Continue reading Invest in…
26 Feb 2018
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 … Continue reading Why…
16 Feb 2018
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 … Continue reading Using XDebug…
27 Feb 2015
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 … Continue reading Using Ruby…
13 Jan 2015
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 … Continue reading Why WordPress…
26 Apr 2014
Hi everybody! Updated Mar 3rd 2015: Are you using Laravel 5? Check these changes! Updated May 11th 2014: Using Corcel project Currently I am working on a project where I had to make some choices about technologies and how work with them together. First this project will be developed using WordPress only. It’s a College … Continue reading Working with…
6 Nov 2013
Let’s supose you want to develop your own URL shortener, like Bit.ly for example. You can, of course, use the ID as a integer, like, 1, 2, 3, etc. If you have 12.345 rows in your database table, you will need 5 digits, like http://example.com/12345. Large applications like Youtube, have much more entries, so, to … Continue reading Generating IDs…
4 Nov 2013
Generally assets are stored in your public directory, right? They are public, so anyone can get access to them. But nowadays the performance is a very important factor when deploying a new app. I strongly recommend you to minify and cache your assets, like CSS files, Javascript files and Images. If you are using 11 … Continue reading Managing assets…
14 Oct 2013
One of the best improvements of the PHP 5.4 was the built-in web server. Like in Ruby On Rails, now you do not need Apache or Nginx inside your development machine. To start a web server is easy: php -S localhost:8000 Remember you can choose the port you want. You can use localhost:8000 or localhost:8080 … Continue reading Working with…
25 Sept 2013
Actually this post is a outflow and at the same time an advice. I have seen some PHP developers that are completely OUT of what is happening in the PHP world, besides committing some mistakes that cannot be accepted. PHP 5.3+ If you are entitled as a PHP developer you must to update. In my … Continue reading Be a…
18 Sept 2013
These days I’m thinking about productivity and the use of PHP frameworks. I’ve read some posts about framework X or Y, defending a framework instead of another one. I know people that use a framework like Zend Framework to develop a simple website just to say they’re using it, and not an “easy” framework. I … Continue reading Solve the…
24 Jun 2013
Hi all! Today I am starting a post series about Design Patterns. I have wrote about them a lot but only suggesting you to learn about to be a better developer. I am studying them, so nothing better to write about and improve my knowledges too. I only ask you to read everything to understand … Continue reading Design Patterns…
21 Jun 2013
Hello again! It’s my second post today! I’m electric! I am developing a project that uses a package I’m developing too. So, it is a real time test project. I find a new way to do something and write it inside my package and uses that. But sometimes this is a boring work. I am … Continue reading Testing your…
Hi guys! Everyone wants to contribute in some way with developers. Maybe you’re thinking in a project to develop and share but you search at Google and find someone who already did that. Maybe the answer to this problem is in front of you. Everything you do can be reused in a future project. If … Continue reading Contributing with…
17 Apr 2013
Update September, 1st 2014 The newer versions of port does not include the ssh-copy-id package anymore, but you can still use it cloning this repo from Github: https://github.com/beautifulcode/ssh-copy-id-for-OSX Hello everybody! I have some servers and always I have to login using SSH, but some passwords is very complex. So, you must copy your public key … Continue reading Installing ssh-copy-id…
7 Mar 2013
Hi everybody! Today I’ll write about how you can contribute with PHP community creating packages (or updating your’s) using Composer and Packagist. First, if you’re a PHP developer and don’t know yet what is Composer, take a look on the post Why you should use Composer and how to start using it to get more … Continue reading Creating your…
26 Jan 2013
Hello! One of the most big changes happening in PHP world is the Composer. I’m shure you heard about it but maybe you don’t know why you should use it and how much it is good for you and your projects. What is Composer? When you need some specific code in PHP you can go … Continue reading Why you…
25 Jan 2013
Hello! Today I had to update a project that was developed using WordPress and PHP 5.3. Today I have PHP 5.4 installed on my machine and this newer version abandoned some old features, and you have some Fatal errors like Call-time pass-by-reference has been removed. The solution was go back to PHP 5.3 and do … Continue reading Working with…
22 Jan 2013
Hello everyone! Use or not to use a PHP Framework on your new projects? Here I’ll talk about my personal opinion about that and I wish help you. First, I have a simple concept about languages and respectives frameworks: a framework must make the development simpler. Every software has a single purpose: work! This is … Continue reading Why you…
18 Jan 2013
Hi all! Last update April 5 2015! I’ll try use the new Yahoo! Mail for a while but I need my old emails messages. I am a Gmail user and want to copy everything to Yahoo! Mail. After search a lot at Google I found imapsync. It is a Linux program that runs on the … Continue reading Migrating emails…
13 Dec 2012
Hi! Today I’ll talk a practice that changed my life. Since when I work developing web applications I used to work with FTP to send files to server. Forget using FTP for that and welcome to the GIT world. GIT became famous after the launch of GitHub website. GIT is a version control tool used … Continue reading Deploying/Upload applications…
11 Oct 2012
Hello! Laravel is an awesome PHP framework created by Taylor Otwell. Actually, it is on the third version and it is one of the great PHP frameworks we have today. As a lot of frameworks, we have to create our own Apache Virtual Host to point to the public dir to improve security and only … Continue reading Deploying Laravel…
19 Sept 2012
Hello all! Let’s continue with our WordPress series. Today I’ll write about the main files in a WordPress theme. First files Above we have some files that are basic for your new theme: index.php This file is the root file, the home page. When you open your WordPress website it’ll get this file content. Is … Continue reading Creating your…
15 Sept 2012
Hello everyone! As I said, this is our second post about Themes in WordPress. Today I’ll talk about: How to create page templates How to retrieve posts If you want you can read the first post about WordPress themes. Let’s GO! Page Templates You can customize pages the way you want, as you want. If … Continue reading Creating your…
13 Sept 2012
Hello again… Continuing with our first WordPress site, now we’ll understand how WordPress allow you to customize themes. If you didn’t read the first post about WordPress Thinking the WordPress Way – First Steps and want to learn how WordPress works, take a look. You don’t have to change your layout or using specific techniques … Continue reading Creating your…
Hello everybody! I work with PHP since 8 years and I never took a look on WordPress. In the start of this year a customer requires me to develop his next website, but using the WordPress. So I had to search some tutorials on the Internet and join informations to make my own way to … Continue reading Thinking the…
Hi all! Yesterday I publish a new blog theme and the spams arrived! Between 12 AM and 7 AM I received 12 spam emails in my Inbox. So, let’s get a free Akismet API Key. I’m using the Akismet WordPress Plugin. Locating the free plan When you open the Akismet signup page you’ll see 3 … Continue reading Getting an…
Hi all! I am here to present my new blog theme. I know that I have to blog more but I am not having time for that. So, yesterday I was thinking in a way to blog more and decided to create a new blog theme. I think a clean and small blog theme can … Continue reading My blog’s…
8 Jun 2012
Hello people! I am now finishing my Post-graduate course in Web Development at PUCMG and I had the RubyOnRails discipline to do. The final work was develop a simple Social Network app using RubyOnRails. I love that framework and think the Ruby language is amazing. So, the final result is shared in GitHub at https://github.com/juniorgrossi/social_network_dsw7 … Continue reading MySocial –…
22 Mar 2012
Hello! Here I am again. Today I will talk about a LESS CSS App for Linux OS. I use both Mac and Linux machines. Using Mac we have the excellent app http://incident57.com/less/. For Linux, we have a executable file (SH commands) that wait for file update and run the lessc command to compile the less … Continue reading LESS CSS…
4 Jan 2012
Hello everyone… Last monday I signup a new VPS (Virtual Private Server) at Rackspace. Let’s go! Why do I need a VPS? Why not a shared host company? You don’t need, but it’s better than a shared host. Using a shared host (usually use cPanel/WHM) you have to follow the company’s rules. If you want … Continue reading Configuring a…
Hello! Today I will talk about secure file upload. Please, do not use chmod 777 on yours upload files. That means everyone can write on your directory and maybe execute that file. Use chmod 755 and be happy. For that you must have to change the directory’s owner to the apache users. In the Ubuntu … Continue reading Secure file…
13 Dec 2011
Hello. Another quick tip. To start a new Zend Framework project, the easiest way is using Zend_Tool for that. Please, install first the Zend_Tool follow this link at Zend Framework documentation page. Creating new project Let’s starting using the command line and creating a new ZF project. zf create project my_project_name Zend_Layout Now, get in … Continue reading Creating new…
Hi all. Here I am again. Today I have a quick tip for beginners using Zend Framework. Do not insert pre and post code (for database) in your Controller. The Zend_Db_Table_Row is for that. Lets create our DatabaseTable class for Posts: /** * Located in .../models/DbTable/Posts.php */ class Posts extends Zend\_Db\_Table_Abstract { protected $_primary = … Continue reading Pre and…
20 Jul 2011
Hello everybody! Usually I have direct access (shell) in all the servers that host my Zend Framework applications, but, some clients already have a shared host, so I have to deploy the application there too. I was thinking how can I never thought this before! There are a lot of ways to deploy a Zend … Continue reading Deploying Zend…
15 Jul 2011
Hi every one! I just read a small but very interesting post in BrownPHP website with a comparison between Zend Framework and CakePHP Framework. The post is below and the original article is here. The Zend Framework, developed by Zend Technologies is an open-source, object oriented web-application framework implemented in PHP 5. It is widely … Continue reading Zend Framework…
13 Jul 2011
Hi everyone, Here I am again. Yesterday a friend asked me how to create the basics CRUD (Create, Release, Update, Delete) operations using Zend Framework. As everybody now, a basic CRUD it’s a good way to understand some framework’s resources to a new ZF developer. As he is a newbie with Zend Framework, the example … Continue reading Basic CRUD…
11 Jul 2011
Hi all… Here we are, again. This will be a quick post, just for warning in a specific case. When you’re using the jQuery Form plugin by malsup.com you are making an AJAX call, but it does not send some variables that identify a XMLHttpRequest (in my case I’m using the plugin with a upload … Continue reading jQuery Form…
Hi all, Sometimes a big part of an application uses AJAX to get content. When getting new content we get new events, already declared in the webapp. For example: $(function(){ $('a.class1').bind('click', function(){ // code here }); }); If the new content (via AJAX) has a link with class1 class, it won’t call this javascript code, … Continue reading Using live…
10 Jul 2011
Boa tarde, pessoal. Me perguntaram por que comecei a blogar em Inglês e não em Português? Temos vários motivos pra isso. O primeiro deles é o fato de saber que tenho MUITO que melhorar no inglês, e sei ainda que o contato diário com a língua é fundamental pra isso. Portanto, blogar em inglês me … Continue reading Inglês? Por…
21 Jun 2011
Boa tarde, pessoal! É muito comum em aplicações web a necessidade de trabalhar com imagens, tanto para redimensionamento, criação de thumbnails, girar, etc. Apresento a Asido, um conjunto de classes para trabalhar com imagens em PHP. Embora eu não goste muito da forma de organização de OO que a Asido utiliza, é uma boa ferramenta … Continue reading Redimensionamento, rotação…
Boa tarde, pessoal! Utilizar onKeyUp para fazer chamadas Ajax é bem interessante, melhorando e muito a experiência do usuário com o sistema, de maneira que os resultados da pesquisa vão aparecendo na medida que ele pressiona as teclas no teclado. Porém, imagine, a cada tecla que o usuário pressiona é uma chamada Ajax na aplicação, … Continue reading setTimeOut para…
Olá pessoal! Esta semana estou trabalhando num projeto onde a utilização de Ajax está sendo muito útil em termos de performance e facilidade na busca de produtos no banco de dados. Como estou utilizando Zend Framework no projeto, vou explicar resumidamente como trabalhar com requisições Ajax no ZF. Basicamente, o óbvio seria desabilitar a renderização … Continue reading Utilizando AjaxContext…
16 Jun 2011
Olá pessoal. Indo direto ao assunto, sempre tive dúvidas quanto a usar o Poedit para traduzir strings, motivo pelo qual usava mais arrays em PHP mesmo. Porém, mais cedo ou mais tarde, necessitamos evoluir e correr atrás do tempo perdido. Sempre achei o Poedit chato e nunca conseguia fazê-lo funcionar. Após umas fuçadas na net … Continue reading Tradução usando…
Olá pessoal. É meu primeiro post no blog. Depois de alguns anos me rendendo à tentação (por falta de tempo), mas sabendo de sua importância, me rendi aos encantos do WordPress e fiz um blog, simples, que espero que sirva de referência para pessoas assim como eu, que todo dia recorre ao Google para tirar … Continue reading Primeiro post…