I was installing the GD library in Ubuntu and I saw other third party libraries that I used to install using Composer such as getid3 and guzzlehttp... So I guess that maybe the compiled libraries are faster and if possible if would be better to install them with apt instead of Composer. Correct if I'm wrong please.
Mev-Rael
Executive Product Leader & Mentor for High-End Influencers and Brands @ mevrael.com
Yes, you are right.
What you call Ubuntu apt ins are called PHP extensions which are written in C and because of that they are faster, however, in modern world with cloud, fast machines and PHP7 there won't be real practical difference for businesses. When a large company requires optimizations, they would just port out some services from PHP and write them on C like Facebook did.
Composer is a PHP package manager. Everything you can download though composer are libraries written on PHP also, which, actually, gives you more flexbility, then C extensions where you have only API and can't change what is inside.
PHP extensions are, as name says, extensions for the PHP core API. For example, many composer image packages requires you to install GD or Imagick because PHP itself doesn't knows how to process images. You also can't install extensions from your app or composer, you need root access for the server itself.