Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Twilio Blog:
Google Spreadsheets and PHP
Mar 08, 2017 @ 09:48:31

On the Twilio blog they've posted an article from Matt Stauffer looking at the combination of Google Sheets and PHP to perform some of the normal CRUD (create, read, update, delete) operations via the Google Sheets API.

Have you ever needed to pull some data from a Google Spreadsheet? My default in the past would be to export the data and upload it to the app directly, but it turns out it’s not very difficult to read directly from Google Spreadsheets using the Google Drive API.

In this tutorial, we’ll read, write, update, and delete data from a Google Spreadsheet with just a few lines of PHP.

He clones an example spreadsheet to use in the tutorial and shows how to prepare it for programatic access (basically exposing it for use). He then gets to work using the google/apiclient and asimlqt/php-google-spreadsheet-client packages to connect to and work with the API. He includes the code to:

  • connect to the API and get a usable token
  • pull data from the sheet by title
  • update individual cells data
  • updating entire rows
  • deleting rows
  • insert new rows

You'll need to be a bit familiar with how the Google API Console works to get things set up, but there's an animation that helps walk you through some of it.

tagged: google sheets tutorial package api crud operation console

Link: https://www.twilio.com/blog/2017/03/google-spreadsheets-and-php.html

SitePoint PHP Blog:
Build Your Own Dropbox Client with the Dropbox API
Nov 04, 2016 @ 09:36:55

On the SitePoint PHP blog there's a new tutorial posted by author Wern Ancheta showing you how to make your own DropBox client with the help of a bit of PHP and the DropBox API.

There are lots of file hosting solutions out there, but few things compare to Dropbox because of its simplicity, auto-sync feature, cross-platform support and other cool features.

As a PHP developer you can even take advantage of their API in order to create apps that use its full capabilities. In this article, you’ll learn how to build one such app to perform different operations in a user’s Dropbox account. You will be using the Dropbox API version 2 in this tutorial. If you want to follow along, you can clone the project from Github.

They start off by walking you through the creation of an application on the DropBox side (required to connect to the API) and how to get its credentials (complete with screenshots). With that set up they get into the application - a simple Laravel-based setup that lets you connect to your account and get information like current file lists, user info and even upload new files. The tutorial includes all of the code for the controllers, models, views, routes, etc. you'll need to make it all work. There's even search functionality letting you look through current files/folders and locate certain items.

tagged: dropbox client api tutorial laravel application upload search list crud

Link: https://www.sitepoint.com/build-your-own-dropbox-client-with-the-dropbox-api/

SitePoint PHP Blog:
A First Look at Atlas – the ORM That Delivers
Oct 17, 2016 @ 15:16:33

The SitePoint PHP blog has posted a new tutorial focusing on the Atlas ORM, a recent addition to the wide range of database ORMs in the PHP ecosystem, focusing on being a mapping of your persistence model.

By definition, a Data Mapper moves data between objects and a database and isolates them from one another. With a Data Mapper, the in memory objects don’t even need to know that a database exists. It does not need to know the SQL interface or database schema; it doesn’t even need the domain layer to know it exists!

This might lead us to thinking that, in Atlas, the persistence layer is totally disconnected from the database, but that is not quite what happens. [...] An Atlas Record is passive; not an active record. Unlike most ORMs, its objects represent the persistence model, not the domain model. Think of it as representing how the data is stored and not as real world representations.

The tutorial goes on to talk about some of the background behind the package being developed and some of its core principles. They then walk you through the installation of the package, doing a bit of related database setup and the code to perform some basic CRUD (create, read, update, delete) operations on the tables. This is followed by a few more practical examples and a few caveats for the library's use.

tagged: atlas orm database tutorial example crud operation

Link: https://www.sitepoint.com/a-first-look-at-atlas-the-orm-that-delivers/

SitePoint PHP Blog:
A Pokemon Crash Course on CouchDB
Aug 12, 2016 @ 10:02:56

The SitePoint PHP blog has a new tutorial posted giving you a "Pokemon Crash Course" on CouchDB, the popular NoSQL database. The "Pokemon" part comes in related to the data the tutorial uses to show you common operations and the use of a PHP interface to perform them.

In this tutorial, we’ll walk through working with CouchDB, a NoSQL database from Apache. This tutorial will focus more on the practical side, so we won’t cover what CouchDB is good for, how to install it, why use it, etc. We’ll focus on how to perform database operations through CouchDB’s HTTP API and how to work with it in PHP, laying the foundation for future, more complex posts.

The article is then broken up into different sections by operation, starting with the use of the CouchDB database via a console then via PHP:

  • Creating a Database
  • Talking to the HTTP API
  • Creating New Documents
  • Bulk Insert
  • Retrieving Documents
  • Updating Documents
  • Working with PHP

Each section includes code snippets and (where relevant) screenshots of the results to help you ensure you're on the right track.

tagged: tutorial couchdb pokemon data introduction crud library example

Link: https://www.sitepoint.com/a-pokemon-crash-course-on-couchdb/

IBM Developer Blog:
Get Started With CouchDB Using PHP and Guzzle
Jul 28, 2016 @ 13:07:48

On the IBM Developer Blog they've posted a new article from Lorna Mitchell helping you get started with CouchDB and Guzzle, making use of this popular HTTP client package to interface with CouchDB's HTTP interface quickly and easily.

In today’s post, we’ll look at how we can use CouchDB in our PHP applications, using the excellent PHP HTTP library Guzzle. Guzzle is a modern, PSR-7 compliant object-oriented PHP library that handles all aspects of HTTP in a correct and — importantly, a scalable — way. So it’s a great way to add any HTTP-interfaced services into your application (PHP 5.5 and later, does support PHP 7).

She then starts off with the installation of Guzzle via Composer and some sample code to make the initial connection to the CouchDB server (either local or remote). With the connection up and working and a "welcome" banner returned, she shows some simple operations like:

  • getting a list of all databases
  • creating a new database
  • inserting and selecting data
  • updating and deleting data

Code is provided for each of these and, thankfully, Guzzle makes it a pretty simple process and handles most of the heavy lifting on the HTTP requests for you.

tagged: couchdb guzzle introduction database http install connect crud

Link: https://developer.ibm.com/clouddataservices/2016/07/27/get-started-with-couchdb-php-guzzle/

SitePoint PHP Blog:
CRUD (Create Read Update Delete) in a Laravel App
May 25, 2015 @ 09:49:11

The SitePoint PHP blog continues their series around the creation of a basic CRUD (create, read, update and delete) application with PHP. In this second part of the series they build on the simple application in the first part and enhance it with the remainder of the CRUD handling.

In the previous part, we’ve bootstrapped our Laravel CRUD application by creating the database, some controllers, basic routes and simple views. In this part, we’ll wrap things up and implement proper CRUD.

He jumps right in and creates the controller action and view to take in new "Task" information. This includes the installation of the Illuminate HTML package and setup of the needed provider and facades. He shows how to create the Task model and hook the results of the request into it and make the new record. This includes some basic "required" validation too. He then shows how to read and display the list of current tasks as well as setting up the edit and delete actions for each task.

tagged: tutorial crud application laravel series part2 model form view

Link: http://www.sitepoint.com/crud-create-read-update-delete-laravel-app/

SitePoint PHP Blog:
Bootstrapping a Laravel CRUD Project
May 21, 2015 @ 11:18:27

The SitePoint PHP blog has kicked off a new series about using the Laravel framework to create a basic CRUD application relatively easily.

In this tutorial, we’re going to build and run a simple CRUD application from scratch using Laravel 5.

The target audience for the tutorial are those completely new to the world of Laravel so they start at the beginning. He walks you through the creation of a new Laravel project and the database setup and configuration. He goes through the creation of "resourceful routing" and using the Laravel "artisan" command line tool to generate the matching controller. From there he talks about views and Blade templating followed by the creation and execution of the needed database migrations. The tutorial wraps up with a look at the model system included with Laravel and how they fit in with the Eloquent ORM.

tagged: bootstrap crud project laravel tutorial series part1 introduction

Link: http://www.sitepoint.com/bootstrapping-laravel-crud-project/

Laravel Podcast:
Episode 20 - The War on CRUD
Jan 08, 2015 @ 10:06:40

The Laravel podcast has posted their latest episode today, Episode #20 - The War on CRUD with host Shawn McCool.

We talk about configuration and queue updates, architecture and CRUD apps, choosing the right persistence solution, and a lot more.

You can catch this latest episode either though the in-page audio player or by watching the Google Hangouts recording it was pulled from. If you enjoy the show, be sure to subscribe to their feed.

tagged: laravelpodcast podcast ep20 war crud shawnmccool

Link: http://www.laravelpodcast.com/episodes/6262-episode-20-the-war-on-crud

SitePoint PHP Blog:
Getting Started with Medoo – Examples of Use
Dec 18, 2014 @ 09:45:26

On the SitePoint PHP blog, there's a new tutorial that introduces you to the Meedoo library, a tool to make working with databases even easier. In this tutorial Wern Ancheta walks you through some of the basics of the tool and shows you how to use it with a Pokemon-based example.

In this article I’m going to walk you through Medoo, a lightweight database abstraction library for PHP. Its main features include: support for multiple databases, being secure and easy to use. [...] While Medoo is nothing revolutionary, and the fact that it sports a very small filesize matters little to few, it’s still an interesting project that went from being outright dismissed to vaguely accepted, as evident in these threads. It’s on its way up, and that’s our reason for taking a look at it.

Once installed (he recommends using Composer) you can follow along with his examples showing how to connect to the database, make a simple select and define something a bit more complex (like multiple other requirements in the SQL statement's "where"). He shows how to execute manual queries and handling more complex operations like joins. He then gets into the other parts of the usual CRUD handling - inserting new data, updating data and deleting data.He finishes the post by mentioning aggregate functions and some of the debugging options the tool includes.

tagged: medoo database tutorial library tool crud complex

Link: http://www.sitepoint.com/getting-started-medoo-examples-use/

Anthony Ferrara:
A Point On MVC And Architecture
Dec 02, 2014 @ 12:10:24

Anthony Ferrara has posted another in his series looking at MVC as a design pattern and as an idea for building web applications. In this latest post he goes on to make a point about MVC, how it relates to architecture and CRUD.

Last week I post a post called Alternatives To MVC. In it, I described some alternatives to MVC and why they all suck as application architectures (or more specifically, are not application architectures). I left a pretty big teaser at the end towards a next post. Well, I'm still working on it. It's a lot bigger job than I realized. But I did want to make a comment on a comment that was left on the last post.

He responds to the comment (essentially that CRUD is a solved problem) and where the need for customizations is needed. He suggests what the real problem is, though: the three classes of developers - CMS users, custom developers and users of both.

tagged: mvc architecture opinion problem crud comment response

Link: http://blog.ircmaxell.com/2014/12/a-point-on-mvc-and-architecture.html