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

fakeheal's avatar

When developing a Laravel package how to specify version of Laravel?

If I am creating a package, specifically for Laravel, how can I "describe" (in my composer.json) that it only works with Laravel 5.3?

For example, in my package I am using Laravel's Session (illuminate/session) and I use Session::set() which is removed from Laravel in 5.4? I don't want people to upgrade their Laravel projects and break their code, because my package doesn't have a version that supports new Laravel features. I want them to get notified by composer when upgrading, so I think I should specify something additional in my package's composer.json.

0 likes
1 reply
devfrey's avatar
devfrey
Best Answer
Level 11

You can specify the versions of the individual Laravel packages as you normally would, or use the generic framework package: "laravel/framework": "5.3.x"

Please or to participate in this conversation.