Skip to content
Readerstacks logo Readerstacks
  • Home
  • Softwares
  • Angular
  • Php
  • Laravel
  • Flutter
Readerstacks logo
Readerstacks
How to ShareSend Message to WhatsApp in Laravel PHP

How to Share/Send Message to WhatsApp in Laravel PHP ?

Aman Jain, March 16, 2022March 16, 2022

Sharing or sending message to whatsapp from a website using a link is simple as possible. In this article we will not use any package or third party tool to share the url or message to whatsapp. Whatsapp itself provide to share or send message using the url so in this article i will show you to share message from your site to whatsapp.

Whatsapp is most used social messaging app and we all want a button on our website to share the our product or contact to provider using whatsapp. So in this article we will cover it in a easy way so it will not take much time to implement.

Screenshot 2022 03 16 at 2.41.24 PM
Share/Send Message to WhatsApp in Laravel PHP

Here is the url

Send or share a page from a website button to whatsapp

We can easily share a a page to whatsapp using below url

https://wa.me/?text=https://readerstacks.com

You can use it in your html as below

<a target="_blank" href='https://wa.me/?text=https://readerstacks.com'>Share to WhatsApp </a>

Send Message from a website button to whatsapp

We can easily open a chat window of a user using below url, you can directly hit in browser or can use in website

https://wa.me/phone_number_of_user

You can use it in your html as below

<a target="_blank" href='https://wa.me/phone_number_of_user'>Share to WhatsApp </a>

Let’s take an example Share/Send Message to WhatsApp in Laravel PHP

Step 1 : Create routes

Add appropriate routes to connect our URL to controller therefore open routes/web.php and add below routes

<?php
use Illuminate\Support\Facades\Route;
use \App\Http\Controllers\PostController;


Route::get('/share-post',[PostController::class, 'share']);

Here we created one route only that means you can create it anywhere but we are using it only our demo purpose.

Step 2 : Create Controller

Now, create the controller as we have mentioned in routes is PostController and also create three methods create, store and refreshCaptcha so create a file in app\Http\Controllers\PostController.php

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;


class PostController extends Controller
{

    public function share()
    {
        return view('post.share-post');
    }
}

Step 5 : Create view

We have create the controller and now we will create the view to show the button for sharing on social media

<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>Readerstacks Share/Send Message to WhatsApp in Laravel PHP </title>

    <link href="//netdna.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" />
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.10.1/css/all.min.css" integrity="sha512-9my9Mb2+0YO+I4PUCSwUYO7sEK21Y0STBAiFEYoWtd2VzLEZZ4QARDrZ30hdM1GlioHJ8o8cWQiy8IAb1hy/Hg==" crossorigin="anonymous" referrerpolicy="no-referrer" />


</head>


<body class="antialiased">
    <div class="container">
        <!-- main app container -->
        <div class="readersack">
            <div class="container">
                <div class="row">
                    <div class="col-md-6 offset-md-3">
                        <h3> Share/Send Message to WhatsApp in Laravel PHP - Readerstacks</h3>

                        <div class="row">

                            <div class="col-12">
                                <a class="btn btn-success" target="_blank" href='https://wa.me/81XXXX912'>Send Message to WhatsApp </a>
                                <a class="btn btn-danger" target="_blank" href='https://wa.me/?text=https://readerstacks.com'>Share to WhatsApp </a>
                            </div>
                        </div>

                    </div>
                </div>
            </div>
        </div>
        <!-- credits -->
        <div class="text-center">
            <p>
                <a href="#" target="_top"> Share/Send Message to WhatsApp in Laravel PHP - Readerstacks</a>
            </p>
            <p>
                <a href="https://readerstacks.com" target="_top">readerstacks.com</a>
            </p>
        </div>
    </div>
</body>

</html>

Also Read : How to Share URL on social media using package in Laravel 9/8/7/6/5 ?

Related

Php Laravel Laravel 9 laravelmessagephpsharewhatsapp

Post navigation

Previous post
Next post

Related Posts

Laravel Get Domain Name in Laravel

How to Get Domain Name in Laravel ?

November 27, 2023March 16, 2024

In this blog post we will learn to get domain name in laravel. Laravel inbuilt library for handling the request and response can do this task very seamlessly. A domain name is the human-readable address that users enter into their browsers to access a website. Knowing the domain name is…

Read More
Php How to fetch Soft Deleted Records in Laravel 9

How to Fetch Soft Deleted Records in Laravel ?

June 17, 2022June 21, 2022

In this article we will learn to fetch soft deleted records in Laravel. In our recent article Use Soft Delete to Temporary (Trash) Delete the Records in Laravel ? we learnt to delete the file without actually deleting from database and sometimes we want to show records that are soft…

Read More
Php How to use laravel whereNotIn query with example

How to use laravel whereNotIn query with example ?

October 15, 2022March 16, 2024

In this guide we will learn to create SQL not in query using laravel whereIn eloquent builder. whereNotIn laravel can used multiple ways to build the query one the of the feature of laravel eloquent is creating dynamic query based on condition and sub queries too. To create where not…

Read More

Aman Jain
Aman Jain

With years of hands-on experience in the realm of web and mobile development, they have honed their skills in various technologies, including Laravel, PHP CodeIgniter, mobile app development, web app development, Flutter, React, JavaScript, Angular, Devops and so much more. Their proficiency extends to building robust REST APIs, AWS Code scaling, and optimization, ensuring that your applications run seamlessly on the cloud.

Categories

  • Angular
  • CSS
  • Dart
  • Devops
  • Flutter
  • HTML
  • Javascript
  • jQuery
  • Laravel
  • Laravel 10
  • Laravel 11
  • Laravel 9
  • Mysql
  • Php
  • Softwares
  • Ubuntu
  • Uncategorized

Archives

  • June 2025
  • May 2025
  • April 2025
  • October 2024
  • July 2024
  • February 2024
  • January 2024
  • December 2023
  • November 2023
  • October 2023
  • July 2023
  • March 2023
  • November 2022
  • October 2022
  • September 2022
  • August 2022
  • July 2022
  • June 2022
  • May 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021

Recent Posts

  • The Resilience of Nature: How Forests Recover After Fires
  • Understanding Laravel Cookie Consent for GDPR Compliance
  • Understanding High Vulnerabilities: A Critical Overview of the Week of May 12, 2025
  • Installing a LAMP Stack on Ubuntu: A Comprehensive Guide
  • Understanding High Vulnerabilities: A Deep Dive into Recent Security Concerns
©2023 Readerstacks | Design and Developed by Readerstacks
Go to mobile version