magento2 – how to add nesbot/carbon to magento 2

See here: https://packagist.org/packages/nesbot/carbon

All you need to do is composer require the package from the Magento root folder. It may not be installable if it has un-met dependency requirements:

composer require nesbot/carbon

Then in your php code:

<?php

namespace VendorModuleModel;

use CarbonCarbon;