Contributing with the PHP community

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 you’re working in a project in the company you works, I’m sure you have some piece of code that you had to thought to develop it. So you can contribute.

I am now developing the WordPress Corcel, that is a small set of classes that works in a WordPress database, retrieving data and working with them. It uses the Eloquent ORM, developed for the Laravel Framework.

This project is the result of a project we’re developing inside my advertising company. We had to integrate some libraries and databases with a WordPress installation but WordPress was too closed to do that, so we started to work in some classes that with Composer we’ll can use in that project, using Slim Framework or another framework that uses Composer too.

Continue reading Contributing with the PHP community

Installing ssh-copy-id on MAC and connect through SSH without password

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 to the desired server and be happy.

Installing the command ssh-copy-id

I used to use mac ports to install packages on my Mac, so: sudo port install ssh-copy-id Now you have the command installed on /opt/local/bin/ssh-copy-id. Just create a symbolic link to that: sudo ln -s /opt/local/bin/ssh-copy-id /usr/bin/ssh-copy-id

Continue reading Installing ssh-copy-id on MAC and connect through SSH without password

Creating your first Composer/Packagist package

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 information about.

Using Composer

Composer is a package manager for PHP. You can use packages the community developed and you can contribute with your packages too. Here I’ll show how to create a project/package, install Composer inside it and send to Packagist, where others developers can use it inside their projects.

Continue reading Creating your first Composer/Packagist package

Why you should use Composer and how to start using it

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 to PHP Classes and search for what you need. For example, you need a class to connect to your Twitter account and get the last updates in your timeline. Ok, you’ll find it easy. And what you have to do after? You download the classe and copy to some place inside your project, and call it including or requiring it inside your PHP code, right?

Well, you can use Pear to. You must install it on your server and install some components that you can use like a package manager. This work too but nothing is installed inside your project structure, but in your machine.

Ok. Composer came to solve all this questions. Together with Composer we have some rules, making all PHP project with the same structure, using namespaces, the same code style, etc. This simplifies when you have to include some third-party code or project. This rules you can find at PHP Fig (PHP Framework Interop Group). I really suggest you to take a look at phptherightway.com. There you’ll find a lot of information to made you a good PHP developer using what we have of better in PHP world.

Continue reading Why you should use Composer and how to start using it

Working with multiple PHP versions on MAC OS-X

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 the updates on my the project, because the production server is with PHP 5.3 too.

The cleaner solution is using Vagrant, that allow you install only what you want for a specific project, leaving your machine cleaner. But was not my case at the moment.

Macports

I’ve used macports to install PHP in my machine. I think macports is a very good way to organize all sources in the same place. More information you can find here.

You can install PHP 5.3 and 5.4 in the same machine and decide what you’ll use just updating your Apache httpd.conf file.

Continue reading Working with multiple PHP versions on MAC OS-X

Why you should use a PHP Framework and why I’m using Laravel

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 the main goal of every project, do that to simplify the life of someone.

Talking about PHP, it is a very simple language. It was projected to be simple and fast. If you want a language complicated or filled of dependencies, PHP is not your best choice.

PHP has the power to do a lot of things in a single line, so, if your framework of choice do the same thing in 3 or 4 lines, use the native PHP way. But you’ll ask me your framework do the same job but much better, using OO, or with beautiful code. Remember you must do the thing and make your project work. Of course the OO programming is the recommended way and you must use it, to make you like easier.

What I want to say is you should use the simpler way, to make the development faster and better. Choose a framework that help you to do the job faster, and use PHP for that. Exists some frameworks that you must learn another language almost. For me a framework must be easy to learn and with minutes you will be developing using it and make money.

Continue reading Why you should use a PHP Framework and why I’m using Laravel

Migrating emails using IMAP (imapsync) to/from (Gmail, Yahoo, etc)

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 command line and can connect to a IMAP server and copy to another one.

Linux Machine

I am a MAC user, so I don’t have Linux machines except servers I don’t want to install things I’ll use just once. So I created a Ubuntu 12.10 64 bits droplet at Digital Ocean and install dependencies and start to sync my emails messages. First we must install dependencies and after install the imapsync. Take a look:

apt-get update
apt-get install libdigest-hmac-perl libdigest-hmac-perl libterm-readkey-perl libterm-readkey-perl libdate-manip-perl libdate-manip-perl libmail-imapclient-perl

Continue reading Migrating emails using IMAP (imapsync) to/from (Gmail, Yahoo, etc)

Deploying/Upload applications using GIT (forget FTP)

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 to manage applications (or files) and control users files update and much more.

Basically you must have:

  • GIT installed on the remote machine and local machine
  • Repositories created on both machines
  • The files you want to deploy/upload

Continue reading Deploying/Upload applications using GIT (forget FTP)

Deploying Laravel applications on a shared host

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 allow access to really public files.

Some people asked me to create a blog post about how to deploy Laravel application to a shared host, like my post about how to Deploying Zend Framework applications on a shared host.

Laravel file structure

A basic Laravel application has the same file structure:

  • application/: your app files, like controllers, routes, models, views, tasks, etc
  • bundles/: the bundle’s files you’ve installed for your app
  • laravel/: the Laravel’s files
  • public/: your public files
  • storage/: files about cache, session, logs, etc
  • artisan: the Laravel command line file
  • licence.txt: licence file
  • paths.php: file with paths information
  • readme.md: just a readme file with Laravel instructions

Continue reading Deploying Laravel applications on a shared host

Creating your first WordPress theme – Part 3 – Important files

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 can also be renamed to home.php, not problem. WordPress will understand that.

header.php

As we saw in the first post about WordPress themes, this is the file you’ll have your header content. Things like navigation, logo, users welcome messages and more, you’ll find in this file.

Continue reading Creating your first WordPress theme – Part 3 – Important files