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

Freek Van der Herten:
Configuring PhpStorms code generation
Dec 05, 2018 @ 19:17:39

Freek Van der Herten has a tutorial posted to his site sharing some customizations you can make to PHP code generation in PhpStorm to fix some issues he's noticed in his own development work in the IDE.

I've been using PhpStorm for quite some time now, but never took the effort to fix a few minor annoyances I had with it.

He shows how to change the generation for:

  • Getting rid of the default comment for new PHP files
  • Compact docblocks for instance variables
  • Fixing the placement of the caret
  • Using fully qualified class names in doc blocks
  • Changing the default visibility

The final item in the post isn't so much a code generation change as it is a tip for saving these changes and your other configuration options. He shows how to back them up on a git repository out on GitHub.

tagged: code generation tutorial phpstorm customize backup

Link: https://murze.be/configuring-phpstorms-code-generation

Pineco.de:
Scheduling MySQL Backups with Laravel
May 28, 2018 @ 18:19:16

On Pineco.de they've posted a new tutorial showing you how to create a MySQL database backup system using Laravel and a command-line call to mysqldump wrapped in an Artisan command.

A few days ago, I signed in to the wrong database and deleted around 18 000 records that were in use. Not to mention, we had no backup for that data. So after all, I decided to make a little script to dump the database and save it to an SQL file automatically.

But, if you are here for a fully working backup system, you should take a look at <a href="https://github.com/spatie/laravel-backup>this package. We won’t cover more just scheduling database exports and its scheduling.

The post starts with the command that will be executed on the command-line and the code required to "warm up" the console and run the command. He shares the code for this command and walks through it, explaining each part. Next comes the scheduling of the task and, as a bonus, setting up the scheduler to run on the Forge service.

tagged: schedule mysql backup laravel mysqldump tutorial

Link: https://pineco.de/scheduling-mysql-backups-with-laravel/

Tim MacDonald:
Backup multiple sites and frameworks with 'Laravel Backup'
Nov 01, 2017 @ 15:56:19

In a new post to his site Tim MacDonald covers a Laravel backup package provided from Spatie and how to use it to backup your sites (and not just Laravel ones).

Using Spatie's Laravel Backup package you can backup several sites on a server from a single app install, including Laravel apps and WordPress sites.

Laravel Backup is a fantastic package brought to us by to ever awesome team at Spatie, and is only one of the many great packages they have in the wild. This package makes it super simple to backup your Laravel applications, including all your files and production database, to a 3rd party storage facility, such as Amazon S3.

He then describes his own setup, running a smaller server that hosts several of his sites that use Laravel, WordPress and static content. He needed a backup solution that would allow for him to manage backups for all of them. He then walks through the setup of the package and how to configure it for each site type. The post finishes with the command to execute and run the backup for the site and how to schedule it as a part of the recurring jobs handling.

tagged: laravel backup tutorial introduction setup configure wordpress static

Link: https://timacdonald.me/backup-multiple-sites-frameworks-laravel-backup/

Freek Van der Herten:
Taking care of backups with Laravel
Sep 19, 2016 @ 14:34:13

Freek Van der Herten has posted a new article to his site covering the backup of your Laravel-based application with a handy package, laravel-backup. He's released a new major version so he wanted to catch you up on some of the features and functionality the package includes and how to use them for your application.

A new major version of laravel-backup was recently tagged. This package can backup files and databases of your Laravel app (or any PHP application really). The backup consists of a zipfile containing a dump of the databases and all files that are selected for backup. The package will copy over the zipfile to external storage such as S3, Dropbox, SFTP, … If something goes wrong during the package can notify you via, amongst others, mail or Slack. In this post I’d like to give some background on why and how it was built.

Keep in mind that there is no one size fits all solution for backups. A small company will probably handle backups in another way than a bigger company. This post has small companies in mind with a couple of developers and no dedicated operations person or team.

He starts off talking about "modern hosting" services and some of the issues that can come with them (downtime being one of the worst). He point out that providers like Linode and DigitalOcean only make periodic backups of your application and restoring from these could mean a lot of data loss - one of the worst things that can happen to an online business. With the laravel-backup package protecting against this kind of failure is easier, letting you automatically back up your site to an off-server source (like S3, Dropbox, or even another local location). He also describes the handling to clean up old backups, sending notifications when problems come up and simple monitoring functionality. He ends the post by mentioning once again that this package is designed for use with small-to-medium sized applications. Larger ones should work up a more robust, possibly external solution that doesn't rely on the application framework for its functionality.

tagged: backup laravel package laravelbackup tutorial downtime

Link: https://murze.be/2016/09/taking-care-of-backups-with-laravel/

SitePoint PHP Blog:
Starting a Business with Laravel Spark
May 02, 2016 @ 16:51:22

On the SitePoint PHP blog there's a new tutorial from Christopher Pitt showing you how to "start a business" with Laravel Spark, the recently released scaffolding product that takes care of a lot of the typical "business" handling for online products.

I am really excited about Laravel Spark. By the time you read this, there will probably be a multitude of posts explaining how you can set it up. That’s not as interesting to me as the journey I’m about to take in creating an actual business with Spark!

The idea is simple. I have created a Pagekit module which you can use to back up and restore site data. The module makes it easy to store and download these backups, and restore them on different servers.

He starts off with some of the background behind the product and getting Spark set up with some additional functionality (like additional user fields and gathering billing information). He then creates the functionality allowing for the actual storing of the backups and API functionality that integrates with it. The post wraps up with his look at adding the code needed to download the backups and return them back to the user.

tagged: laravel spark tutorial business pagekit backup tutorial introduction

Link: http://www.sitepoint.com/starting-a-business-with-laravel-spark/

Freek Van der Herten:
A modern backup solution for Laravel apps
Mar 09, 2016 @ 17:15:54

As Freek Van der Herten mentions in this post to his site the latest release of the Laravel backup package has been released - version 3 - with some major improvements over previous releases.

Today our team released a new major version of laravel-backup. It can backup the files and databases of your application to one or more external filesystems. It uses Laravel’s native cloud filesystem to do this. The package can also notify you via Slack and/or email when something goes wrong with your backups. We’ve also created a dedicated site with full documentation. In this blogpost we want to give you some background of why and how the package was created.

They start out with a bit of history about the package, talking about how they created it to fill their own needs and how its risen in popularity since its release. Following this the post talks about new features in version 3 including:

  • Taking backups
  • Cleaning up old backups
  • Monitoring the health of all backups
  • Sending notifications

There's also some brief mentions of other new features around event hooks and adding additional information to the backup file. There's a bit of code shared to show the quality/readbility of the code and links over to various resources on the documentation site as well. Finally they mention some information about the use of the package in PHP 5 (it has become PHP 7 focused with this release) and some of the alternatives that are out there.

tagged: backup laravel package php7 release improvement features history php5

Link: https://murze.be/2016/03/a-modern-backup-solution-for-laravel-apps/

Laravel News Podcast:
LN 08: Database Backups
Jan 28, 2016 @ 18:56:39

The Laravel News podcast with host Eric Barnes has posted their latest episode: Episode 8 - Database Backups.

Episode 8 of the Laravel News podcast is now out.

This episode features special guest Freek Van der Herten talking about backups, Test Driven Laravel, WordPress & Laravel, and PDF generation.

You can listen to this latest episode either by subscribing over on iTunes or pointing your feed reader at the RSS feed and grabbing the latest from there. If you're interested in listening to previous episodes, be sure to check out the podcast archive section on the Laravel News site.

tagged: laravelnews laravel podcast news ep8 ericbarnes database backup

Link: https://laravel-news.com/2016/01/ln-08-database-backups/

Matthew Turland:
PHPUnit + XHProf = BOOM!
Oct 14, 2015 @ 14:38:22

Matthew Turland has a post to his site sharing his experience with the PHPUnit and XHProf combination...and the unfortunate result that made every test fail.

I ran into an issue recently while trying to run PHPUnit tests in an environment using XHProf. Google didn’t prove to be much help, so I thought I’d document the problem and solution here for posterity.

When I ran my tests, each failed with the same cryptic error and no backtrace: "Attempted to serialize unserializable builtin class PDO" The cause was the culmination of two rather unfortunate circumstances.

He shares the two problems that causes this issue - one being XHProf's use of globals (where its PDO connection is stored) and the other is the @backupGlobals setting in PHPUnit that's enabled by default. This makes PHPUnit to try to backup that PDO connection by serializing it but can't, hence the failure. He points out a pull request that aims to fix the issue but recommends disabling the globals backup for the time being if you don't have a need for it.

tagged: phpunit xhprof combine globals pdo error backup

Link: http://matthewturland.com/2015/10/13/phpunit-xhprof-boom/

PHPBuilder.com:
Implementing Automatic Database Backup and Optimization in PHP
Nov 27, 2013 @ 16:52:31

On PHPBuilder.com today they have a new article posted sharing a few different methods you can use to do backups of your (MySQL) database and a few handy tricks/tools you can use to optimize it as well.

Every computer system has a backup. Nevertheless, the number of problems caused by a lack of a recent backup is huge. One of the reasons for that may be the fact that the backup process is not entirely automated. So, let's see how to automate the database backup process in PHP.

There's three recommendations for the (simple) database backup that can produce a file of the current database contents - mysqldump, mysqlhostcopy and a "SELECT INTO OUTFILE" statement. On the optimization size they suggest mysqlcheck, an OPTIMIZE query to help find trouble spots. There's a script included at the end showing how these methods can be combined into a simple PHP script, something that can easily be dropped into a cron job to perform every so often.

tagged: automatic database backup optimization

Link: http://www.phpbuilder.com/articles/databases/mysql/implementing-automatic-database-backup-and-optimization-in-php.html

Automated backups to Google Drive with PHP API
Apr 16, 2013 @ 15:57:01

On his site Lukasz Kujawa has posted a new tutorial showing you how to perform automated backups to Google Drive of files through their API (using his own library).

Where do you keep backups? I guess that depends on what do you backup. You might have a very clever answer for a business critical data but what about less important content? The best example would be a private blog. It will hurt if you lose your data but the odds are you’re not willing to pay for any reliable storage. [...] There is one reliable storage, which is 100% free and almost everybody have access to it. Yes, I’m talking about Google Drive.

He walks you through the process of setting up your Google Drive account API access and where to find the data you'll need to make the connection. He then links over to his project that makes the backup a simple few lines of code (mostly configuration) of a backup path of your choice out to the remote Google Drive account.

tagged: automated backup cp2google library google drive tutorial

Link: http://systemsarchitect.net/automated-backups-to-google-drive-with-php-api


Trending Topics: