Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Str::ulid() not working #44167

Closed
tanthammar opened this issue Sep 16, 2022 · 8 comments
Closed

Str::ulid() not working #44167

tanthammar opened this issue Sep 16, 2022 · 8 comments

Comments

@tanthammar
Copy link
Contributor

tanthammar commented Sep 16, 2022

There is something wrong with the Illuminate Support symfony/uid requirement.
I had to manually composer require symfony/uid to get Str::ulid() to work.

Originally posted by @tanthammar in #44074 (comment)

Laravel v 9.30.1

Class "Symfony\Component\Uid\Ulid" not found
@huangdijia
Copy link
Contributor

huangdijia commented Sep 16, 2022

composer r symfony/uid

@tanthammar
Copy link
Contributor Author

tanthammar commented Sep 16, 2022

@huangdijia Sorry, I don't understand your comment?

I did manually install the dependency with composer require, but what I want to say is that it should be required by Laravel Framework in order for the Str::ulid() to work properly.

Or, do I misunderstand you?

Also see where I commented in the pr.

@rodrigopedra
Copy link
Contributor

symfony/uid is in the suggests session of illuminate/support's composer.json.

So to use its functionality you should manually install this dependency.

@tanthammar
Copy link
Contributor Author

@rodrigopedra
Aha, then I get it :)
Thought it was released with in Laravel 9.30.1, as the method Str::ulid() exists.

@rodrigopedra
Copy link
Contributor

rodrigopedra commented Sep 16, 2022

No, I actually just saw they have released it after I sent my first answer (now deleted) about the release date.

I didn't think they would have introduced a new public method on a patch release. As I had the same method macro'ed I was keeping an eye on the next minor release to test it out before updating.

The Str::ulid() is already available, and you can use it.

But as some other optional features in the framework, you must install the suggested dependency manually if you plan on using this method. It is an opt-in feature.

This is similar on using S3 storage. All code is available in the framework, but you need to manually install league/flysystem-aws-s3-v3 (which then requires AWS SDK) composer package to use it.

So, to summarize:

  • the PR is merged and released
  • code for Str::ulid() is released and available to use
  • To make use of it you need to opt-in by manually requiring the suggested symfony/uid package

Hope it is clearer now. Sorry for the confusion.

@tanthammar
Copy link
Contributor Author

Thank you @rodrigopedra
Never came across a "Str" helper before that requires manually installing a package .
Being spoiled by the framework :)

Anyway, it was easy to figure out, and I guess it will be added to the docs that it requires manual installation

@DarkGhostHunter
Copy link
Contributor

Added method to documentation, along with a not to require symfony/ulid so it can work.

laravel/docs#8226

@driesvints
Copy link
Member

I sent in a PR to require the package instead to make it easier: #44202

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants