Share a PHP package with Composer and Packagist

Hi there! In this quick tutorial we will see how to create a package for your PHP class/library with composer and publish it on packagist.org.

You probably are already using composer to manage dependencies in your projects and search for packages to speed up your development.

And guess what… creating your packages and giving back to the PHP community is as easy as requiring them!

Before we start…

(Skip this part if you already have composer installed and you project code on a version control system)

Installing composer

You will need composer installed on your system to create and test your packages so, if you don’t have it already, let’s go ahead and install it.

I recommend you install composer globally so then you can access it in any directory by just typing composer:

curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer

# After it finishes, test it!
composer --version

Although, if you are on windows or just want a to install composer locally for your project, you can check their quick start guide.

Continue reading

PHP Security YouTube Series by Codecourse

php_security

This YouTube series from Codecourse gives you a good overview of the most common PHP security issues. They use a very practical approach, showing how the attacks are done and how to protect your code from them.

This course is a series of useful tips and tutorials around the basics of PHP security, which makes it really accessible to all levels of PHP developers.

And, although most of these security problems are already taken care if you use a modern MVC framework like Laravel or Symfony, it’s always good to be aware of how they work and how they are protected within those frameworks.

PHP Security Series Contents:

  1. Include/require file extensions – 3:10
  2. XSS (Cross-site Scripting) – 14:59
  3. Password hashing – 7:47
  4. Directory listing – 3:10
  5. HttpOnly Cookies – 3:52
  6. What you shouldn’t store in cookies – 3:51
  7. CSRF (Cross-site Request Forgery) – 11:32
  8. User defined file includes – 6:51
  9. SQL Injection – 9:16
  10. Error Reporting – 5:53

Total Time – ~1:10:00

Continue reading