How to Install/Update TYPO3 & Extension via TYPO3 Composer

Are you new to the TYPO3 Composer world? And, Are you looking for quick steps to install, update and remove TYPO3 composer packages? This microblog will help you to initiate your TYPO3 composer journey quickly.

How to Install/Update TYPO3 & Extension via TYPO3 Composer

Are you new to the TYPO3 Composer world? And, Are you looking for quick steps to install, update and remove TYPO3 composer packages? This microblog will help you to initiate your TYPO3 composer journey quickly.

TYPO3 composer - A dependency manager for PHP. TYPO3 composer is getting widely popular and welcomed by the TYPO3 community. It will create an environment like heaven for you - To easily install, update and remove TYPO3 core and TYPO3 extensions. If you have decided to use a composer to follow all the next TYPO3 projects, follow this step-by-step composer guide.

A composer is a tool for dependency management in PHP. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you.
- Composer.org

Step 1. Install Composer

Choose your favorite way to install composer to your Unix/Linux or macOS machine, and you will need to find a way to install it from Composer’s official site.

Option 1. Official Guide from Getcomposer.org

 

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === 'e0012edf3e80b6978849f5eff0d4b4e4c79ff1609dd1e613307e16318854d24ae64f26d17af3ef0bf7cfb710ca74755a') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"

 

Option 2. Using Standard Application Install

 

sudo apt-get update
sudo apt-get install composer
composer -v

 

Option 3. Using Curl + Application Get

 

sudo apt-get update
sudo apt-get install curl php-cli git
curl -sS getcomposer.org/installer | sudo php - --install-dir = / usr / local / bin --filename = composer

Step 2. Enable Composer Command

Once you install composer, I recommend running the following commands so that you can run the “composer command”.

 

// Move composer.phar to bin to run as composer command
mv composer.phar /usr/local/bin/composer
chmod +x /usr/local/bin/composer

// Before above commands
/usr/local/bin/composer -v

// After the above commands
composer -v

Step 3. Install TYPO3 Core Using Composer

Let’s officially download and install TYPO3 core using the composer-based TYPO3 instance.

 

// create and change directory
mkdir test-typo3
cd test-typo3

// Download the Base Distribution, the latest "LTS" release (10)
composer create "typo3/cms-base-distribution:^10" --prefer-dist

// create FIRST_INSTALL file in the folder public/
touch public/FIRST_INSTALL

// Launch your TYPO3 instance & Complete TYPO3 Installation Steps

Step 4. Install TYPO3 Extension Using Composer

Grab your favorite TYPO3 extension’s composer command, Example https://extensions.typo3.org/extension/ns_backup 

 

// Install TYPO3 News Extension
composer require nitsan/ns-backup

// Activate TYPO3 News Extension
./vendor/bin/typo3 extension:activate ns_backup

// After Installation of TYPO3 Extension, Check your composer.json should add an entry of your installed TYPO3 extension
"require": {
    "typo3/cms": "~7.6.0",
    "nitsan/ns-backup": "^4.0.0"
}

Step 5. Update/Remove TYPO3 & Extensions Using Composer

To maintain, update or remove TYPO3 packages, you can follow the update or remove the TYPO3 composer command as below.

 

// Update TYPO3 core to latest version
composer update typo3/cms --with-all-dependencies

// Update TYPO3 to particular version
composer update typo3/cms ^10.4

// Update TYPO3 Packages to latest version
composer update nitsan/ns-backup

// Update TYPO3 Packages to particular version
composer update nitsan/ns-backup ^1.1

// De-Activate TYPO3 Packages to Remove
./vendor/bin/typo3 extension:activate ns_backup

// Remove TYPO3 Packages from Composer
composer remove nitsan/ns-backup

Wrapping-up!

Thanks for reading this quick guide blog. I hope you learned the composer basics.

Of course, by the time and practice, I’m sure you will love to run your TYPO3 instance using composer-only :) Do you have any questions or problems with the TYPO3 composer? Let me know in the comment box, and I'll be happy to help you.

Have a Happy TYPO3 Composer!

Your One Stop Solutions for Custom TYPO3 Development

  • A Decade of TYPO3 Industry Experience
  • 250+ Successful TYPO3 Projects
  • 87% Repeat TYPO3 Customers
Get Your Free Quote

Post a Comment

×
Captcha Code Can't read the image? Click here to refresh