Level up your Twilio API skills in TwilioQuest, an educational game for Mac, Windows, and Linux. Download Now
Build the future of communications.
Start building for free

PHP posts

  • By Matthew Setter
    PHPで環境変数を使用する方法 PHPで環境変数を使用する方法

    この記事はMatthew Setterこちらで公開した記事(英語)を日本語化したものです。

    環境変数は、PHPアプリケーションを構築する上で非常に便利なツールです。環境変数を使えば、アプリケーションの設定をコード外に保管できます。コード外に保管することで、認証情報の漏洩を防いだり、 アプリケーションを効率的にメンテナンスしたり、複数の環境にわたってアプリケーションを使用することが容易になります。





    例えば、$_SERVERにはリクエストヘッダー、パス、スクリプトの場所が含まれ、 $_SESSIONにはセッション変数が含まれます。また、$_POSTにはHTTP POSTメソッドで呼ばれたときに現在のスクリプトに渡される変数が含まれます。


    Read More
  • By Brian Iyoha
    LaravelとTwilioでSMSポータルを作る方法 LaravelとTwilioでSMSポータルを作る方法

    この記事はBrian Iyohaこちらで公開した記事(英語)を日本語化したものです。



    このチュートリアルでは、TwilioのProgrammable SMSとLaravelを使用してSMS通知ポータル(管理画面)を作成する方法をご紹介します。







    • Laravelの基礎知識。
    • ローカルマシンにインストールされたLaravel
    • グローバルにインストールされたComposer
    • ローカルマシンに設定されたMySQL
    • Twilioのアカウント。Twilioホームページをブラウザで開き、[今すぐ無料サインアップ]ボタンをクリックするか、Twilioアカウントの作成リンクからサインアップします。このリンクを使用するとアカウントのアップグレード時に$10( …
    Read More
  • By Matthew Setter
    Improve PHP Web App Performance Using Memcached Improve PHP Web App Performance Using Memcached

    In the first part of this series, I stepped through how to create a Markdown-powered blog in PHP using the Slim Framework. In this, the second part in the series, you're going to learn how to use Memcached with PHP to improve the application's performance.

    Let's begin!


    You need the following to follow this tutorial:

    Why use caching?

    While the initial version works perfectly well, its performance would peak reasonably quickly, because — on every request — the blog data is aggregated from a collection of Markdown files with YAML frontmatter in the application's filesystem, parsing out the article data before the blog data can …

    Read More
  • By Matthew Setter
    Build Your Own Weather Station With PHP, Python and a Raspberry Pi Build your own weather station with PHP, Python and a Raspberry Pi

    Raspberry Pi, Arduino, BeagleBone, and similar technologies have had a revolutionary impact on so many people around the world.

    Because they provide the building blocks of computing for a very low price, anyone, from a school student to a retiree, with a little bit of time and effort, can build a device that perfectly scratches whatever itch they have. They no longer need to wait for a commercial organisation to build it.

    One such itch (at least one that I have) is to measure the current temperature and humidity throughout the rooms in my home. Sure, weather app's can tell you the current temperature and humidity, however, they can only do it for a wide geographical area.

    So, in this tutorial, you're going to learn how to create a small weather station with a Raspberry Pi, some PHP and Python code, and a temperature and humidity sensor — for …

    Read More
  • By Ijeoma Nelson
    How to Create a High Converting Sales Page Using PHP, Twilio Messaging, Google's App Engine, and Stripe's API How to Create a High Converting Sales Page Using PHP, Twilio Messaging, Google’s App Engine, and Stripe’s API

    Today's fast-paced, digital economy has created a culture where people want to know how to compete in the global market, what skills are emerging, and how best to learn them.

    Consequently, more and more people are choosing educational resources, such as ebooks and video tutorials, to help us fill the knowledge gap necessary to improve our lot in life.

    And why not? Whether it's resume writing, DIY, or personal budgeting, there's a guru ready to take you from novice to ninja — "in just seven days!"

    Forecast to be worth $350 Billion by 2025, the online learning industry has not only taken the world by storm, it has also created new opportunities for everyday people to become digital entrepreneurs.

    With the abundance of e-commerce platforms, website builders, and content management systems readily available, just about anyone can launch a sales page and start selling e-courses or ebooks.

    How does …

    Read More
  • By Joseph Udonsak
    A Beginner's Guide to Test Driven Development With Symfony and Codeception - Part 3 A Beginner's Guide to Test Driven Development With Symfony and Codeception - Part 3

    Welcome back! It’s been an amazing tour of planet TDD (Test Driven Development) so far. In this series, you’ve learned the benefits of TDD, and gotten your hands dirty building a P2P (Peer-to-peer) payment application.

    Using Symfony and Codeception, you’ve worked through the Red-Green-Refactor cycle, gradually implementing new features via Sliming. You've also seen how TDD protects code from regressions.

    In this, the third and final part in the series, you'll implement the last feature of the application using TDD, transaction history. In addition to that, you'll learn about the concept of test coverage and how it impacts application reliability.


    To follow this tutorial, you need the following things:

    Getting started

    If you already have the code from the first part in this series, you can skip this section. However, …

    Read More
  • By Michael Okoh
    Laravel PHPでRESTful APIを構築する方法 Laravel PHPでRESTful APIを構築する方法

    この記事はMichael Okohこちらで公開した記事(英語)を日本語化したものです。

    ソーシャルネットワークから銀行アプリケーションまで、現代社会は多くのAPIで動いています。本稿では、Laravel PHPを使ってRESTful APIと、それを実装するアプリケーションを構築する方法について学びます。



    • PHP 7.1以降
    • Composer
    • MySQL
    • Laravel 5.6以降
    • Postman


    本稿では、学生に関するデータを取り扱うCRUD APIを構築します。CRUDは、Create(作成)、Read(読み取り)、Update(更新)、Delete(削除)を意味します。このAPIには、次のエンドポイントがあります。

    • GET /api/studentsは、すべての学生レコードを返し、GETリクエストを受け入れます。
    • GET /api/students/{id}は、学生レコードのidを参照して学生レコードを返し、GETリクエストを受け入れます。
    • POST /api/studentsは、新しい学生レコードを作成し、POSTリクエストを受け入れます。
    • PUT /api/students/{id}は、学生レコードのidを参照して既存の学生レコードを更新し、PUTリクエストを受け入れます。
    • DELETE /api/students/{id}は、学生レコードのidを参照して学生レコードを削除し、DELETE …
    Read More
  • By Matthew Setter
    PHPでQRコードを作成する方法 Copy of C02 Blog Text (5).png

    この記事はMatthew Setterこちらで公開した記事(英語)を日本語化したものです。






    • PHPの基礎知識。
    • GD拡張機能がインストールされているPHP 7.4。
    • グローバルにインストールされたComposer
    • スマートフォン。



    mkdir -p php-qr-code-generator \
        php-qr-code-generator/src/QR/{Image,Options} \
    cd php-qr-code-generator

    Microsoft Windowsを使用している場合は、次のコマンドを実行します。

    mkdir php-qr-code-generator
    mkdir php-qr-code-generator/src/QR/Image
    mkd …
    Read More
  • By Matthew Setter
    How to Manage Application Secrets With PHP Using Vault How to Manage Application Secrets With PHP Using Vault

    For far too many years, PHP developers stored application credentials and secrets, such as usernames, passwords, and API keys, alongside their code.

    While extremely convenient, this practice was a security nightmare just waiting to happen; if someone could access an application’s source code, they had access to all of its sensitive data too.

    Nowadays, this practice is nowhere near as common as it once was. Rather, it's now incredibly common to store credentials separately from code in dotenv files (.env) which makes them available as environment variables.

    However, while this is a significant improvement, this practice still isn't the best way to keep credentials and secrets secure. For example, if the .env file is accidentally committed to version control, then the credentials and secrets are once again stored alongside code.

    Alternatively, if a malicious actor can access the environment where an application is running from, they can access …

    Read More
  • By Matthew Setter
    Send Scheduled SMS with PHP and Twilio Programmable Messaging Send Scheduled SMS with PHP and Twilio Programmable Messaging

    Twilio Programmable Messaging lets you send SMS, MMS, and WhatsApp messages. However, up until recently, it didn't support scheduling messages for a future date and time. If you wanted to do that, you had to roll that functionality yourself, likely using a Cron job, or some scheduling tool, to retrieve stored messages from a database, and create them when they needed to be sent.

    Now, though, you can schedule SMS messages with a single API call using Message Scheduling!

    In this tutorial, you’ll learn how to schedule SMS ahead of time using PHP. To make the tutorial a little more meaningful, assume that you are writing the code to help remind people about upcoming meetings of the local club that you're a member of.

    Tutorial Requirements

    You will need these items to follow along with this tutorial:

    • PHP 7.4 (ideally 8.1)
    • Composer installed globally
    • A free or paid Twilio …
    Read More
  • Newer
    Sign up and start building
    Not ready yet? Talk to an expert.