Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

mellymatt's avatar

Why does Laravel have it's own Carbon class?

Hi I was just wondering why Laravel has it's own Carbon class at \Illuminate\Support\Carbon. It looks like just an empty extension of the Carbon class.

<?php

namespace Illuminate\Support;

use Carbon\Carbon as BaseCarbon;

class Carbon extends BaseCarbon
{
    //
}

Thanks :)

0 likes
5 replies
mellymatt's avatar

Thanks for sharing that link. Makes sense.

jlrdw's avatar

@martinbean i meant laravel (the framework) pulls in the actual carbon, the vendor code on it would be for things like helpers Taylor has put there. So technically there is no laravel carbon, but laravel using carbon.

That's why the use statement:

use Carbon\Carbon as BaseCarbon;

@mellymatt sorry if I worded it wrong. I know there's even newer helpers from a @jeffreyway video I watched.

For a better idea, you can scroll through this search:

https://github.com/laravel/framework/search?q=carbon

Notice also used in test.

Please or to participate in this conversation.