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

Michael Dyrynda:
Sharing databases between Laravel applications
Apr 13, 2018 @ 14:39:16

Michael Dyrynda has a new post to his site showing the Laravel users out there how to share a database between your applications. In his case one of the applications is a legacy app and the other is a newer Laravel application.

As a contractor, I had a sanitised copy of the database, and I managed to reverse engineer the Eloquent models from the database schema, creating factories along the way, in order to be able to write tests for the members application.

In late 2017, we started migrating our CRM to Laravel as well, in order to modernise the code base a bit, give it a standard structure, and make it easy to make changes to it moving forward. Now that we had two Laravel applications, we started looking at how best to share data between them.

He starts by talking about reverse engineering the models from the database structure and the use of migrations to manage the database schema. In the end he created a stand-alone tool, Nomad, that helps to keep things in sync between the two databases. He includes examples of it in use and how it helped to keep the database in sync despite permissions issues and connection problems. He also mentions how they used it to take care of some testing issues, database configuration changes and how to use it in a continuous integration pipeline.

tagged: share database laravel application nomad tool migration schema

Link: https://dyrynda.com.au/blog/sharing-databases-between-laravel-applications

Zeev Suraski:
Your PHP Stories
Jul 28, 2017 @ 15:43:39

Zeev Suraski of Zend has a post on his personal site asking the developers and community out there for any interesting PHP stories they might be willing to share.

Do you have an interesting story that involves PHP? Something awkward, unexpected or inspiring that happened to you or that you witnessed that was related to PHP and/or its community? Did PHP help you meet your spouse, otherwise change your life or enable you to change other people's lives?

I have no doubt that there's some interesting stories out there. If you're one of the many that has one (even if you don't think it's that interesting it might be to others) you can find his contact information on the post to share it.

tagged: stories community interesting community share

Link: http://zsuraski.blogspot.ae/2017/07/your-php-stories.html

Gonzalo Ayuso:
Sharing authentication between socket.io and a PHP frontend (using JSON Web Tokens)
Jun 06, 2016 @ 16:50:29

In a follow up to his previous post about sharing authentication information between socket.io and PHP, Gonzalo Ayuso has posted an updated method using JSON Web Tokens instead.

I’ve written a previous post about Sharing authentication between socket.io and a PHP frontend but after publish the post a colleague (hi @mariotux) told me that I can use JSON Web Tokens (jwt) to do this. I had never used jwt before so I decided to study a little bit.

JWT are pretty straightforward. You only need to create the token and send it to the client. You don’t need to store this token within a database. Client can decode and validate it on its own.

He updates the code from the previous post, showing how to replace the HTTP basic authentication with the JWT functionality. He makes use of some simple JWT library handling to encode/decode the claims when the token is made a part of the request.

tagged: socketio share authentication frontend jwt jsonwebtokens

Link: https://gonzalo123.com/2016/06/06/sharing-authentication-between-socket-io-and-a-php-frontend-using-json-web-tokens/

Knp University:
Our favorite PhpStorm Live Templates: Share yours
Aug 21, 2015 @ 15:49:39

The Knp University site has a posted an article where they've shared their favorite PHPStorm Live templates, a set of handy shortcuts that can make for less typing on your part and, as a result, less development time spent on common keystrokes.

Most editors have a feature like this, and if you’re not leveraging them, you’re slowing yourself down. Seriously: taking a few minutes to get into these now could add up to a lot of hours saved in the future. The vim users at KnpLabs love this kind of stuff, and have published their own snippets (docteurklein, PedroTroller, Einenlum).

In our tutorial about live templates, we turn formhandle into a snippet that types about 10 lines of form-handling boilerplate code from 10 characters of text. So I started wondering: what are some other awesome live templates we should all be using?

To this end, they've created a repository to store some of these helpful shortcuts. Their list so far includes shortcuts for a 404 if statement, several Twig tags, several for use in a controller context and YAML formatting. The repository includes instructions on how to install the shortcuts and how to include only the ones you want.

tagged: phpstorm live template share repository starter snippet shortcut

Link: http://knpuniversity.com/blog/phpstorm-live-templates

Evan Coury's Blog:
Sharing a database connection across modules in Zend Framework 2
Apr 27, 2012 @ 14:54:56

Evan Coury has a new post to his site about a handy method for sharing database connections across modules in a Zend Framework application.

With the new modular infrastructure in Zend Framework 2, one of the most common questions will indoubitably be how to share a database connection across modules. Here’s a quick explanation of how to share your database connection across multiple modules in a way that can even allow you to use a single connection between ZendDb, Doctrine2, and possibly even other database libraries / ORMs.

He includes the code in the post to configure this application-wide database resource, a "masterdb_pdo" that uses a MySQL backend. This configuration is used to set up the connection in a dependency injection container for later (globalish) use. He also mentions something similar about sharing Doctrine connections with the ZendDb components (using the same DI container approach).

tagged: share database connection module application zenddb zenddi doctrine2

Link:

Kevin Schroeder's Blog:
Call for webinars (Zend)
Jan 18, 2012 @ 17:50:07

Kevin Schroeder is looking for suggestions. He wants to know what the PHP community wants to hear about in upcoming webinars from Zend.

Just wrapped up a call working on our webinar schedule for the year. We’ve got a bunch of ideas but we’d like to also get your input as well. Yes, I know y’all want ZF2 webinars. We have that down. I would also like to do an HTML5 and mobile webinar but I need an SME (Subject Matter Expert) for that. [...] I would also love to have webinars on how to use various API’s, even if there is not native PHP support. So, what kinds of webinars do you want?

Leave your suggestions in his comments along with one already suggesting a "Why PHP?" checklist of sorts to help encourage companies/employers to go with the language.

tagged: opinion webinar share zend zf2 html5 api

Link:

Anthony Ferrara's Blog:
Becoming A Better Developer
Nov 09, 2011 @ 14:54:27

Anthony Ferrara has a new post today on his blog with some things he think you can do to become a better overall developer (and not just in PHP). He shares six things from his own experience to help answer this question.

One of the most frequent questions that I get asked is "How can I become a better developer?" I think that it's a very good question to ask that deserves a good response. But how can you respond to something like that? Becoming a better developer depends so heavily on past experience (where to grow), interests and rationale (why do you want to grow), that it's really hard to answer without a fair bit of discussion. This post reflects my experiences from both my own growth and the growth that I've seen in others.

The things on his list are pretty simple, but they're easy to forget in your day to day development life. Things like being motivated to better yourself, gaining confidence in your abilities, sharing your knowledge and/or becoming a mentor to developers with less experience than you. Interestingly enough, this last one can sometimes teach you a little something about you and your processes too.

tagged: better developer opinion motivation confidence learn share mentor

Link:

99Points.info:
Youtube Style Share Button With URL Shortening using CURL, jQuery and PHP
Jul 29, 2010 @ 17:38:28

In a recent post on the 99Points.info blog Zeeshan Rasool walks you through the steps to create a share button with URL shortening using PHP, jQuery and curl.

These days every website must contain a section that is called “Share This”. After creating facebook style posting and youtube style rating system I have now come to share button. I have created youtube style share button with url shortening script. Try the demo and use this awesome tutorial on your web pages.

His tutorial includes all of the code needed - Javascript, PHP and some CSS - to create a small "share this" button that can be embedded in your site to open pages on the remote sites with the shortened URL for the current page.

tagged: tutorial url shorten share curl jquery youtube

Link:

Sebastian Bergmann's Blog:
Sharing Fixtures and Stubbing/Mocking Static Methods
Feb 15, 2010 @ 18:55:49

Sebastian Bergmann has two recent posts dealing with some of the more difficult topics in unit testing. One looks at sharing fixtures between tests and the other talks about stubbing and mocking static methods in your tests.

From the first of the two tutorials:

A good example of a fixture that makes sense to share across several tests is a database connection: you log into the database once and reuse the database connection instead of creating a new connection for each test. This makes your tests run faster.

This fixture sharing example uses the setUpBeforeClass and tearDownAfterClass methods to create and destroy the connection.

In the second article Sebastian shows how to mock up a sample static function and mock it with the "staticExpects" helper.

tagged: phpunit unittest stub mock static share fixture

Link:

Web Development Blog:
Search for photos using PHP and the flickr API
Dec 21, 2009 @ 21:16:31

On the Web Development Blog there's a recent post about connecting your PHP application with the Flickr API to search for photos with the help of a simple class.

We will be using the php function "file_get_contents" to receive data from flickr. The data which we will receive will be a serialized PHP array which means all we need to do is unserialize the array and we will easily be able to use the data returned. As an alternative we can use a cURL function to get the data, for example if the function "file_get_contents" is not allowed on your web host.

They show how to get your API key from the Flickr website and the sample code that you'll need to make a GET request (with file_get_contents) and an example of a loop displaying the response.

tagged: flickr share api connect tutorial

Link:


Trending Topics: