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

Nikola Posa:
Keep PhpStorm metadata away from project sources
Mar 15, 2017 @ 16:54:57

In a new post to his site Nikola Posa shows the PHPStorm users out there how to keep metadata about your projects away from the source (the content in the ./idea directory it creates by default).

I fell in love with PhpStorm only few months ago ago when I switched from NetBeans, my favorite IDE by then. One thing that I was missing from the very start is the ability to separate project metadata (.idea/ directory) from sources, because I like to keep away everything that is unnecessary from my project directory, as well as from the .gitignore file. It turned out that something like that is possible, but in contrast to NetBeans it's not so evident and requires a little more effort

It's a pretty simple four step process and he shows what settings to change:

  • Create new project in a directory where you would usually keep metadata
  • Open Settings / Preferences dialog and click on Directories node
  • Click Add Content Root button and select project sources directory
  • Remove content root that keeps project metadata

Screenshots are also included for each step to help make sure you're in the right place at all times.

tagged: phpstorm metadata project source setting configuration

Link: http://blog.nikolaposa.in.rs/2017/03/09/phpstorm-metadata-away-from-project-sources/

Community News:
PHPPackages.org
Jun 17, 2015 @ 16:48:32

A new community resource, built on top of the excellent Composer and Packagist technology that's popular in today's PHP development world, has been released and provides more context about libraries and provides a "rank" for each one - PHPPackages.org.

PHPPackages.org was built to solve the following problems: [it] defines popularity rank for php packages, provide a space for discussion and [helps to] discover which packages use a specific package.

The About page has more information about the site, how they calculate the "popularity" metric, what the various icons mean and what kinds of things you can do on the site. It's a great resource, especially for those wondering who is using their packages and to discover new packages that are more widely used. It has a lot of the same information that the Packagist site contains but that little extra bit of data is quite useful.

tagged: phppackages composer packagist metadata library package popularity

Link: https://phppackages.org/

NetTuts.com:
How To Display Post Meta Data on a WordPress Post
Jul 11, 2014 @ 15:44:41

NetTuts.com has a a recent tutorial showing you how to show the metadata from a posting in WordPress right along with the other post data.

During the course of the series, one of the things that we did in order to help demonstrate the object-oriented principles as well as some of the features of the WordPress API was build a plugin. Specifically, we built a plugin that allowed us to view all of the post meta data associated with a given post within the WordPress dashboard. [...] Since that particular post was written, I've received a number of different questions one of which has been how do we take the data displayed in the dashboard - that is, the post meta data - and display it on the front end of the web site. In this article, we're going to take a look at extending the plugin such that we can display the data on a single post page.

To display the data, they actually extend the plugin they've already made. They start with some of the issues of this method (and the data itself) that you might run into during the development. They create a "public" directory to store the cached metadata in and a manager class to handle the functionality. The class loads the data and uses output buffering to capture the data. A public hook is defined to call the "display" action on each page load and the results are passed out to the view.

tagged: wordpress metadata plugin extend tutorial action

Link: http://code.tutsplus.com/tutorials/how-to-display-post-meta-data-on-a-wordpress-post--cms-21658

Pádraic Brady:
PHP Package Signing: My Current Thoughts
Mar 10, 2014 @ 16:57:49

Pádraic Brady has a new post sharing some of his ideas around PHP package signing and a few possible ways to approach (and possibly solve) the problem.

We figured out how to write good code. We figured out how to write good code in a reusable way...for the most part. We figured out how to distribute and mix all that good reusable code in a sensible fashion. Can we now figure out how to do it all securely? [...] The problem with package signing from my perspective is tied up in a phrase most of you would know: The needs of the many outweigh the needs of the few. Thank you, Spock.

He compares two different alternatives, Public-key infrastructure (PKI) vs (Pretty Good Privacy) GPG, and how the idea of trust fits into the picture. He also points out an unfortunate fact when it comes to the initial adoption of package signing methods - people are lazy (and cheap). They want to get things done and not have extra steps. Signing their packages would be one of these steps. He suggests an alternative, though, using double signatures to verify the integrity and validity of its contents. He also talks about the role that metadata plays in the overall package ecosystem and how signing it as well could be part of the solution.

tagged: package signature signing metadata packagist composer

Link: http://blog.astrumfutura.com/2014/03/php-package-signing-my-current-thoughts

Benjamin Eberlei:
Feature Flags and Doctrine Entities
Dec 06, 2013 @ 15:40:00

In a new post to his site Benjamin Eberlei takes a look at the idea of "feature flags" (settings to turn on and off major features) and how they can be used with Doctrine entities to handle sync issues between new properties and the database schema.

The problem of feature flags with Doctrine is easily explained: If you add properties for a new feature that is disabled in the Doctrine metadata, then you need to upgrade the database before deployment, even when the feature is not being rolled out for some days/weeks. Doctrine requires the database to look exactly like the metadata specifies it.

His solution was to use the "loadClassMetadata" event in the entity to dynamically append these new properties based on simple "if" checks of feature flags in the configuration object. Obviously using this is a bit of a hack until the new properties are in place, but once they are then the only change is removing this code.

tagged: feature flag doctrine entities class metadata if check

Link: http://www.whitewashing.de/2013/12/05/feature_flags_and_doctrine_entities.html

PHPMaster.com:
Introspection and Reflection in PHP
May 25, 2012 @ 19:03:57

On PHPMaster.com today there's an introduction to Reflection, a feature of PHP that allows you to peer into the code itself and find out metadata like class properties, scope levels and parent classes.

PHP introspection is a common feature in any programming language which allows object classes to be manipulated by the programmer. You’ll find introspection particularly useful when you don’t know which class or method you need to execute at design time. [...] During this article, you’ll see a couple examples of how to use some of the most useful PHP’s introspection function and a section dedicated to an API that offers functionality similar to introspection, the Reflection API.

They introduce you to a few different methods including class_exists, get_class and get_class_vars and method_exists. They also briefly mention the "ReflectionClass" that's a part of the PHP Reflection API and how it can be used to make an instance pointing to a current class.

tagged: introspection reflection tutorial api metadata

Link:

ZetCode.com:
PostgreSQL PHP Tutorial
May 07, 2012 @ 16:14:40

On the ZetCode.com site there's a five part tutorial posted about getting your PHP application up and running on a PostgreSQL database (updated on the 4th).

This is a PHP tutorial for the PostgreSQL database. It covers the basics of PostgreSQL programming with PHP. The examples were created and tested on Linux. [...] PostgreSQL is a powerful, open source object-relational database system. It is a multi-user, multi-threaded database management system. It runs on multiple platforms including Linux, FreeBSD, Solaris, Microsoft Windows and Mac OS X. PostgreSQL is developed by the PostgreSQL Global Development Group.

The chapters guide you through every step you'll need:

tagged: postgresql tutorial introduction read images metadata transactions

Link:

Gennady Feldman's Blog:
Leveraging Oracle connection metadata functionality
May 27, 2010 @ 17:48:11

Gennady Feldman has a new post to his site looking at a feature of the Oracle connection functionality that comes with PHP's integration with the powerful database - metadata functionality.

Now with OEM finding what the query is is really easy (you might need to buy Oracle Performance pack to monitor vitals and performance information). So you know which query caused the spike. Do you know where that query is in your application code? [...] You already have a ton of applications written, having to go through every query to add this meta information is a ton of dev effort. What do you do?

He's found a way to help solve the problem - you can use a few handy functions to let you set some more information about the connection. These settings can give you more information about the client, a client identifier, module information and what action or function is performing the query. This information can then be queried in via the V$session variable on the server side.

tagged: oracle connection metadata function

Link:

Zend Developer Zone:
Reading and Writing MP3 and Photo Metadata with PECL
Nov 11, 2008 @ 14:44:45

The Zend Developer Zone has a new tutorial from Vikram Vaswani looking at the reading and writing of metadata for mp3s and images with two handy PECL extensions.

It's just that every time I sit down to have a go at [finding something in my photo or mp3 library], the sheer volume of data overwhelms me and I take the command decision to deal with something easier instead. Sounds familiar? If it does, help is at hand, in the form of PHP's ID3 and EXIF extensions. These extensions can help you organize and catalog your digital media collection so that it's easier to navigate and search. Keep reading, and I'll show you how.

He installs the ID3 package first (via the pecl command line tool) and gives a few sample scripts to pull the metadata information out of a mp3 file as well as update/remove the information that's already there. He even sets up a simple SQLite database to store the information he's retrieved.

The second part of the tutorial looks at grabbing the image metadata via the EXIF extension. This can yield all sorts of information including date/time the photo was taken, the resolution, the model of the camera and various camera settings at the time. He includes a sample script that automatically makes thumbnails for the images via the exif_thumbnail function.

tagged: pecl package id3 exif mp3 photo metadata tutorial

Link:

Devshed:
Database Details and PHP
Jun 28, 2007 @ 17:12:00

DevShed continues their tutorial series looking at working with PHP and databases today with more excerpted material from the O'Reilly book "Programming PHP, Second Edition" (by Kevin Tatroe, Rasmus Lerdorf, and Peter MacIntyre).

Picking up from where we left off last week, we'll be discussing shortcuts, query responses, metadata, and more.

They start off looking at shortcuts, those handy things the PEAR DB package offers to make life simpler (like getRow and getAssoc) before moving on to how to get the details about the response itself (like affectedRows and tableInfo). Next up is working with the metadata (using getListOf) and, finally, a sample application to tie them all together.

tagged: database tutorial metadata detail query response database tutorial metadata detail query response

Link:


Trending Topics: