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

Php File Validation in laravel 8

How to use file validation in Laravel 8 with example

November 27, 2021January 26, 2022

Laravel provides multiple ways to validate a form or a file in form with it’s own validation library. In this tutorial we will learn about the image validation for specific extension and file size. In this tutorial i will use a simple form and a file input field to validate…

Read More
Php How to Change Date Format in Blade View File in Laravel

How to Change Date Format in Blade View File in Laravel ?

September 8, 2022March 16, 2024

Laravel default shows the date in the way its stored in database bu sometimes we want to change date format in blade view file in laravel according to our requirements. It can be multiple possibilities and requirement from client or product manager to change the date format so in this…

Read More
Php How to Update Enum Field Value using Laravel Migration

How to Update Enum Field Value using Laravel Migration ?

August 13, 2022March 16, 2024

Sometime after add the values in enum field we wanted to Update Enum Field Value using Laravel Migration so that we can work according to requirements. In our last article How to Create Enum Field in Laravel Migration ? we learnt to create the enum and today we are give…

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

  • July 2025
  • 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

  • Mapping Together: The Vibrant Spirit of OpenStreetMap Japan
  • Understanding High Vulnerabilities: A Deep Dive into the Weekly Summary
  • Building a Million-Dollar Brand: The Journey of Justin Jackson
  • Mastering Schedule Management with Laravel Zap
  • The Resilience of Nature: How Forests Recover After Fires
©2023 Readerstacks | Design and Developed by Readerstacks
Go to mobile version