PHP8, Symfony5, and Composer2, Oh

PHP8, Symfony5, and Composer2, Oh

Part of my vacation time I like to spend learning and playing with tech. As I spend every waking moment of my professional day in the “frontend” space, I wanted to step back into the “backend” space and my roots of PHP and explore what’s new with PHP8 in particular. I have always been a huge fan of Symfony, so I wanted to start with the latest. This documents my journey as a “noob” to a “Hello World!” First, I wanted to install Ubuntu 20.04 LTS so I had a decent baseline. I live a double life as a PC gamer, so my main workstation is a Windows PC that now thankfully supports Windows Subsystem Linux; in my case WSL2. Install Ubuntu 20.04 First, make sure you’re running WSL. Part of that includes selecting a distribution. If you’re in a situation like me where you’re running an older version (18.04 LTS in my case) and want to update to the latest, those steps are here: sudo apt update sudo apt list --upgradable sudo apt upgrade sudo apt --purge autoremove sudo apt install update-manager-core sudo do-release-upgrade You may see an error message “You have not rebooted after installing a package” — if you do, open PowerShell as an Administrator and run the following: Restart-Service LxssManager When completed, you should be able to see the following after running within your instance: wsl cat /etc/os-release Jake Litwicki - www.jakelitwicki.com Install PHP8 (Ubuntu) Installing PHP8 takes mere moments within your linux instance. Simple run these commands, or download as a simple bash script: sudo apt install software-properties-common sudo add-apt-repository ppa:ondrej/php sudo apt install php8.0-common php8.0-cli -y sudo apt install php8.0-{bz2,curl,intl,mysql,readline,xml} sudo apt install php8.0-pcov # PCOV code coverage tool sudo apt install php8.0-xdebug # Xdebug debugger # for nginx #sudo apt install php8.0-fpm # for apache #sudo apt install libapache2-mod-php8.0 # purge old versions of PHP if applicable sudo apt purge '^php7.*' One liner install: Jake Litwicki - www.jakelitwicki.com wget https://gist.githubusercontent.com/litwicki/bb370bec4aed448966f5c51463 16a497/raw/2b9c0f09ef1733654fc628a0df1822c6ac33cb5e/php8-ubuntu- install -O - -q | bash Install Composer 2 https://getcomposer.org/doc/faqs/how-to-install-composer-programmatically.md #!/bin/sh EXPECTED_CHECKSUM="$(wget -q -O - https://composer.github.io/installer.sig)" php -r "copy('https://getcomposer.org/installer', 'composer- setup.php');" ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer- setup.php');")" if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ] then >&2 echo 'ERROR: Invalid installer checksum' rm composer-setup.php exit 1 fi php composer-setup.php --quiet RESULT=$? rm composer-setup.php exit $RESULT One liner install: Jake Litwicki - www.jakelitwicki.com wget https://raw.githubusercontent.com/composer/getcomposer.org/76a7060ccb9 3902cd7576b67264ad91c8a2700e2/web/installer -O - -q | php -- --quiet Install Composer globally: chmod +x composer.phar mv composer.phar /usr/bin/composer Setup Symfony app I am an avid fan of Symfony as a framework because of its flexibility and dedication to performance and extensibility. First, install the symfony CLI: wget https://get.symfony.com/cli/installer -O - | bash Next, create your naked Symfony app: symfony new my-app symfony server:ca:install Enjoy! symfony serve Jake Litwicki - www.jakelitwicki.com Jake Litwicki - www.jakelitwicki.com.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    5 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us