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

LucasWEB's avatar

Problem with a package in Laravel 8.83

Hello,

We have problems when updating our platform to Laravel 8 and php 8.1.10 we use the Embed/embed package and when creating a QRcode from a link provided by the user we have this error: Call to undefined method Embed\Embed::create()

We did however check if the package was up to date, it is in version 4.4.4 , it well added at the top of the file with a "use" in front and it seems to me that the package is not depreciated.

Here is the problematic code:

// Get url info $error = ''; $url = request()->get('redirect_to_url', null);

    try {
        $info = Embed::create($url);

        $qr_code->user_id = auth()->user()->id;
        $qr_code->redirect_to_url = $url;
        $qr_code->title = $info->title;
        $qr_code->description = $info->description;
        $image = ($info->image !== null) ? $info->image: \Czim\Paperclip\Attachment\Attachment::NULL_ATTACHMENT;
        $qr_code->image = $image;
        $qr_code->icon = $info->providerIcon;

        $qr_code->save();

        if ($sl == null) {
            $qr_code->qr = new \SplFileInfo(public_path(\DNS2D::getBarcodePNGPath($qr_code->getUrl(), 'QRCODE', 70, 70, [0, 0, 0])));
            $qr_code->save();
        }

        return redirect('dashboard/qr')->with('message', $msg);

    } catch (\ErrorException $e) {
        $validator->getMessageBag()->add('redirect_to_url', $e->getMessage());
    } catch (\Embed\Exceptions\InvalidUrlException $e) {
        $validator->getMessageBag()->add('redirect_to_url', $e->getMessage());
    }

I can't find out if the create method is no longer available in version 4

Can you help us with that? Thank you in advance.

0 likes
2 replies

Please or to participate in this conversation.