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

Laravel News:
Minio: An Open-Source S3 Compliant Storage Service
Aug 07, 2017 @ 14:33:23

On the Laravel News site they've posted a tutorial showing you how to use Minio for storage and integrate it into a Laravel application as another filesystem location.

Have you ever wanted a local version of Amazon S3 while developing Laravel applications? Well want no more, Minio is an open-source distributed object storage server built in Golang. The best part: Minio is Amazon S3 compatible. Let’s go through setting up Minio locally and then try out the new temporaryUrl method introduced in Laravel v5.4.31.

They walk you through the setup of the Minio server (locally, instructions are for brew on OS X) how to access it directly to ensure it is up and running. The tutorial then shows how to integrate it into the Laravel configuration as another file system location (as it is S3 compliant). It also shows how to create a "test" bucket for the content storage and using the "Storage" handling to push a file to the Minio service.

tagged: minio s3 storage opensource laravel tutorial integration golang

Link: https://laravel-news.com/minio-s3-compliant-storage

TutsPlus.com:
Programming With Yii2: Using Amazon S3
Dec 08, 2016 @ 17:27:16

The TutsPlus.com site has continued their series of posts in the "Programming with Yii2" series with this new tutorial covering the use of the Amazon S3 service for sorting files remotely in your application.

In today's tutorial, I'll walk you through the basics of browsing, uploading and downloading files to and from Amazon's cloud-based S3 storage service. Essentially, I've created a simple storage model and controller as examples which you can extend for your needs.

He starts with a brief introduction to the S3 service (including a video from Amazon themselves) and what kinds of things it could be used for. He helps you get started via the AWS web GUI, creating an S3 "bucket" and viewing their contents. He shows how to get the credentials you'll need to connect to the bucket and defining them in the ini configuration file. The tutorial then shows how to use this AWS extension for Yii2 to connect to and work with the S3 bucket you've created. This includes browsing the content, uploading new files and downloading current ones.

tagged: yii2 framework series amazon s3 file storage download upload tutorial

Link: https://code.tutsplus.com/tutorials/programming-with-yii2-using-amazon-s3--cms-26347

Stovepipe Systems:
Using bitwise instead of booleans
Aug 18, 2016 @ 16:18:44

On the Stovepipe Systems blog there's a new post from Yannick de Lange that suggests using bitwose operations instead of booleans to evaluate an on/off setting.

The naive way of storing many boolean options (in a database) is to create for each option a field and storing a 0 when it is false and 1 when it is true. Which of course works, but adding options will require a new field, which might require creating a compatibility layer for your old data. There is an easier way to do this and it's even more efficient at checking fields.

This brings me to an old topic which I have to explain to all the new people at some point and even once explained not everybody understands how it actually works. So in this post I'm going to explain how to use bitwise operators and how it works internally.

He starts with a common example using the 0/1 storage method and refactors it a bit to use different values that are more compatible with bitwise operations. He includes the usage of this system and how to works to evaluate multiple potential option values.

tagged: bitwise option boolean storage enable setting tutorial

Link: http://stovepipe.systems/post/using-bitwise-instead-of-booleans

SitePoint PHP Blog:
Install and Integrate Elasticsearch with Drupal
Apr 10, 2015 @ 15:37:55

The SitePoint PHP blog has a recent tutorial posted showing you how to integrate Drupal and Elasticsearch to make for more effective searching of your content. This is the second part of this series.

In this tutorial I am going to look at the possibility of using Drupal 7 as a content management system that powers another high performance application. To illustrate the latter, I will use the Silex PHP microframework and Elasticsearch as the data source. The goal is to create a proof of concept, demonstrating using these three technologies together. [...] The tutorial will be split into two pieces, because there is quite a lot of ground to cover. In this part, we’ll set up Elasticsearch on the server and integrate it with Drupal by creating a small, custom module that will insert, update, and delete Drupal nodes into Elasticsearch.

They assume you already have an Elasticsearch install set up and ready to go but do offer some suggestions on how to configure it to be a little bit more secure. Then, in your Drupal application (again, already installed) they show you how to use the Elasticsearch module to connect to the ES instance and, once connected, insert, update and delete data for the data in your nodes.

tagged: tutorial elasticsearch drupal integrate node storage

Link: http://www.sitepoint.com/install-integrate-elasticsearch-drupal/

AWS Development Blog:
DynamoDB JSON and Array Marshaling for PHP
Feb 04, 2015 @ 16:51:30

In the latest post to the AWS PHP Development blog Jeremy Lindblom looks at a new feature of their PHP SDK that allows for more flexibility (and easier handling) when using DynamoDB for document storage in storing more complex data.

Back in October of 2014, Amazon DynamoDB added support for new data types, including the map (M) and list (L) types. These new types, along with some API updates, make it possible to store more complex, multilevel data, and use DynamoDB for document storage.

He talks about a new class thats been added to help work with the DynamoDB storage, the DynamoDb Marshaler (in version >= 2.2.7) that handles the push and pull of the JSON document data directly from the storage, reducing the need to perform the operation manually. He includes code examples of its use and JSON examples of what results are returned on a get request. He also shows how to use it with a native PHP array, translating it with help from the Marshaler and the "marshalItem" method.

tagged: aws development sdk amazon dynamodb json storage marshaler

Link: http://blogs.aws.amazon.com/php/post/Tx3QE1CEXG8QG1Z/DynamoDB-JSON-and-Array-Marshaling-for-PHP

A toolbox for less than $100 / month
Jul 03, 2014 @ 14:35:42

Joshua Thijssen has shared his toolbox for less than $100/month that includes a complete set of development and project tools "on the cheap" but still good.

There are a lot of tools out there which can help you as a developer / self-employed contractor. And even though most of these tools are free (as in beer), I don’t mind spending a certain amount of money on tools that help me do my business. So with all the tools out there, all the paid plans, the freemiums and the trial periods, what can a crispy 100 dollar bill every month buy?

His list includes hosting (ServerGrove), issue tracking (Jira), team communication (HipChat) and online storage (Dropbox). His list is made up of eight services with almost all of them having a small cost. The online collaboration (Basecamp) and hosting (from ServerGrove) are the highest costs at $20USD/month.

tagged: toolbox onehundred hosting communication storage issuetracking automation

Link: https://www.adayinthelifeof.nl/2014/07/01/a-toolbox-for-less-than-100-month/

The Code of a Ninja:
Salt, Hash and Store Passwords Securely with Phpass
Jun 16, 2014 @ 16:15:37

In this post to the CodeOfANinjs.com site, they walk you through password hashing, salting and storage using the PHPAss tool from OpenWall. The post itself is a bit older, but the content still provides a good example to teach the basics.

I think the main reason why we have to hash passwords is to prevent passwords from being stolen or compromised. You see, even if someone steal your database, they will never read your actual or cleartext password. I know that some PHP frameworks or CMS already provide this functionality, but I believe that it is important for us to know how its implementation can be made.

The tutorial shows you how to use the library and how to store the result in a simple "users" table in a MySQL database. The examples hash the password given from a simple form and use prepared statements (via PDO) to save it to the database. All PHP, HTML and CSS code you'll need - including the login form that checks the username/password - is included. There's also a few screenshots showing what the resulting forms and data should look like.

tagged: phpass tutorial hash salt password storage mysql user

Link: http://www.codeofaninja.com/2013/03/php-hash-password.html

PHPMaster.com:
Saving PHP Sessions in Redis
Jul 09, 2013 @ 15:53:01

On PHPMaster.com today there's a new tutorial showing you how to store your application's sessions in Redis, a key/value store known for its flexible nature and speed.

PHP’s default handling of session data is probably sufficient for most applications, but sometimes a project will demand a different storage approach. Luckily, the session handling routines can be overridden either by a series of functions (in older versions of PHP) or a class with methods (in newer versions) which handle various aspects of session management. In this article we’ll learn how to create a custom session handler which implements PHP’s SessionHandlerInterface interface and stores the session data in a Redis database.

He talks some about the reasoning behind using something more than just the normal PHP session handling (including the flexibility it provides). He covers some of the basics of the session handling functionality and covers how the data itself is stored. Finally, he gets to the actual class - a Redis-specific handler that implements the SessionHandlerInterface interface.

tagged: tutorial redis session storage save introduction

Link: http://phpmaster.com/saving-php-sessions-in-redis/

Zurab Davitiani:
PHP Sessions in Erlang Mnesia
Jul 02, 2013 @ 16:31:43

In a new post to his site Zurab Davitiani shows you how to use a PHP-to-Erlang bridge to store your sessions in Mnesia. Mnesia is a distributed, soft real-time database management system written in the Erlang programming language.

I decided one of the simplest things to do would be to create a session storage for PHP in Mnesia. But that, in doing so, I would also create an extremely simple key value store wrapper around Mnesia which would track access times.

The instructions help you get the needed software set up including mypeb, kvstore and lib360. He lists all the steps needed to get the platform up and running, complete with exact commands to execute. He does point out a few things that are missing from the setup including making kvstore easier to work with and some PHP session garbage collection.

tagged: erlang mnesia session tutorial storage database

Link: http://unix0.wordpress.com/2013/06/22/php-sessions-in-erlang-mnesia

Sameer Borate:
Storing images into a database - resolving a contentious matter
Feb 21, 2013 @ 17:16:45

In this new post to his CodeDiesel site Sameer Borate looks at something that's been a controversial topic with developers (not just PHP) about storing binary data, like images, in a database instead of on the local file system.

There is much discussion and argument with no final say on the issue. In one of my recent project the same issue was raised; the client and myself discussing the benefits and drawback of storing the images into a database. The project needed storing around 50,000 images, so it was important to get the question resolved satisfactorily. After much deliberation we settled on using the file system. The major factor in the decision was that we needed the database and images decoupled as we would be having multiple databases using the same set of images.

He goes on to talk about some of the things you should consider when you're deciding if storing images in the database is the right thing for your application including:

  • The bloat that can come with storing binary data (larger database size)
  • Updating images requires two operations - updating the database and updating the cached image locally
  • Images usually serve faster when they come from the filesystem through the web server
  • BLOB (a common type for binary data storage) is variable-width and can degrade performance

You can read the rest of the reasons (and get more detail on the ones above) in the rest of the post.

tagged: images binary data storage database benefits disadvantages

Link:


Trending Topics: