Paul M. JonesUsing Aura.Html with League\Plates (23.3.2015, 17:37 UTC)

Aura has its own native PHP template package, Aura.View, a direct descendant of Savant and Solar_View, as well as a cousin to Zend_View.

The v1 Aura.View package used to include a helper system. Once we realized that there was no reason to tie the helper system directly to the view system, we released the helpers as a standalone Aura.Html package. This means the helpers can be used in any PHP presentation code, framework-based or otherwise.

As an example, let’s try integrating the helpers with Plates, a relative newcomer in the native PHP templating world. Plates allows you to register functions with its template engine, which means we can pull individual helpers out of Aura.Html and drop them into Plates, like so:

<?php
$plates = new League\Plates\Engine('/path/to/templates');
$helper = (new Aura\Html\HelperLocatorFactory())->newInstance();

$plates->registerFunction('anchor',     $helper->get('anchor'));
$plates->registerFunction('anchorRaw',  $helper->get('anchorRaw'));
$plates->registerFunction('base',       $helper->get('base'));
$plates->registerFunction('form',       $helper->get('form'));
$plates->registerFunction('img',        $helper->get('img'));
$plates->registerFunction('input',      $helper->get('input'));
$plates->registerFunction('label',      $helper->get('label'));
$plates->registerFunction('links',      $helper->get('links'));
$plates->registerFunction('metas',      $helper->get('metas'));
$plates->registerFunction('ol',         $helper->get('ol'));
$plates->registerFunction('scripts',    $helper->get('scripts'));
$plates->registerFunction('styles',     $helper->get('styles'));
$plates->registerFunction('tag',        $helper->get('tag'));
$plates->registerFunction('title',      $helper->get('title'));
$plates->registerFunction('ul',         $helper->get('ul'));
?>

Now you can use the tag helpers and form-building helpers from Aura.Html in your Plates templates. For example, if your Plates template looks like this …

<html>
<head>
<?= $this->title('My Title'); ?>
</head>
<body>
<p>Try out <?= $this->anchor(
    'https://github.com/auraphp/Aura.Html',
    'Aura.Html'
); ?>
with <?= $this->anchor(
    'http://platesphp.com',
    'Plates'
); ?> !</p>
</body>
</html>

… it will render to:

<html>
<head>
    <title>My Title</title>
</head>
<body>
<p>Try out <a href="https://github.com/auraphp/Aura.Html">Aura.Html</a>
with <a href="http://platesphp.com">Plates</a> !</p>
</body>
</html>

Try out Aura.Html today, and see how much you like it with your output system of choice. (We’re partial to Aura.View for that task, but then, we would be.)

UPDATE: As usual, Hari KT is ahead of the curve with his post on this same topic from a year ago: http://harikt.com/blog/2014/05/13/extending-plates-with-aura-html-helpers/.

UPDATE 2: Someone asked how easy it is to use Aura.Html with Aura.View. It’s 3-lines-easy: see https://github.com/auraphp/Aura.View#custom-helper-managers.

Link
SitePoint PHPGetting Started with SQLite3 – Basic Commands (23.3.2015, 16:00 UTC)

SQLite is a C library that implements an SQL database engine. It is a Relational Database Management System (or RDBMS). Most of the SQL databases work with the client/server model. Take MySQL for an example. To enter and receive data from a MySQL database you need to send a request to the MySQL server, which on reception will provide you with the appropriate response. Contrary to MySQL, SQLite databases are operated directly from the disk. There is no need to create requests to the server.

SQLite370.svg (Custom)

Installation

We will operate on our database using the sqlite31 Command Line Interface(CLI). We will work under the Linux Platform. sqlite3 CLI for MAC OS and Windows are just the same, but for the sake of consistency, it’s recommended you install Homestead Improved - a lightweight VM runnable in 5 minutes that will keep your computer clean of extra unneeded software.

To install it on Homestead Improved (or any Debian based OS like Ubuntu), run the following:

[code language="bash"] sudo apt-get install sqlite3 libsqlite3-dev [/code]

This will install sqlite3. To install it on other platforms, follow their official instructions. After it is installed we can start the session. Open the Terminal/Command Line and enter the command sqlite3. You must see something of this kind :

CLI sqlite3

The second line tells you to enter .help for instructions. There is a prompt waiting for you to type a command. So go ahead and enter .help. This will give you a list of Meta Commands and their descriptions.

Continue reading %Getting Started with SQLite3 – Basic Commands%

Link
PHP ClassesPHP 7 Scalar Type Hinting Finally Approved (23.3.2015, 04:35 UTC)
By Joseluis Laso (aka Patrick)
After a long debate, a proposal to implement type hinting for scalar function parameters and return values was just approved with the highest vote count so far.

Read this article to understand what scalar type hinting is and how you can benefit from it when you will run your code with PHP 7.
Link
Nomad PHPAll About the New NEW Facebook PHP SDK v4.1 (21.3.2015, 14:57 UTC)

Speaker: Sammy Powers @SammyK When developing on Facebook, things change all the time. And things are about to change once again with the release of the Facebook PHP SDK v4.1. It’s got tons of new powerful features that have never existed in a Facebook PHP SDK before. This lightning talk is focused on giving a …

The post All About the New NEW Facebook PHP SDK v4.1 appeared first on Nomad PHP.

Link
Nomad PHPConvert a Laravel Application from 4 to 5 (21.3.2015, 14:54 UTC)

Speaker: Matt Stauffer @stauffermatt Changing major versions of a framework can be a daunting task, and the Laravel 4 to Laravel 5 upgrade path has had a lot of people talking lately. We’ll take an open-source Laravel 4 project and walk through the steps to convert a Laravel application from 4 to 5.

The post Convert a Laravel Application from 4 to 5 appeared first on Nomad PHP.

Link
SitePoint PHPFirst Look at Platform.sh – a Development and Deployment SaaS (20.3.2015, 16:00 UTC)

Not so long ago, many of us were satisfied handling deployment of our projects by uploading files via FTP to a web server. I was doing it myself until relatively recently and still do on occasion (don’t tell anyone!). At some point in the past few years, demand for the services and features offered by web applications rose, team sizes grew and rapid iteration became the norm. The old methods for deploying became unstable, unreliable and (generally) untrusted.

So was born a new wave of tools, services and workflows designed to simplify the process of deploying complex web applications, along with a plethora of accompanying commercial services. Generally, they offer an integrated toolset for version control, hosting, performance and security at a competitive price.

Platform.sh is a newer player on the market, built by the team at Commerce Guys, who are better known for their Drupal eCommerce solutions. Initially, the service only supported Drupal based hosting and deployment, but it has rapidly added support for Symfony, Wordpress, Zend and ‘pure’ PHP, with node.js, Python and Ruby coming soon.

It follows the microservice architecture concept and offers an increasing amount of server, performance and profiling options to add and remove from your application stack with ease.

I tend to find these services make far more sense with a simple example. I will use a Drupal platform as it’s what I’m most familiar with.

Platform.sh has a couple of requirements that vary for each platform. In Drupal’s case they are:

  • An id_rsa public/private key pair
  • Git
  • Composer
  • The Platform.sh CLI
  • Drush

I won’t cover installing these here; more details can be found in the Platform.sh documentation section.

I had a couple of test platforms created for me by the Platform.sh team, and for the sake of this example, we can treat these as my workplace adding me to some new projects I need to work on. I can see these listed by issuing the platform project:list command inside my preferred working directory.

Continue reading %First Look at Platform.sh – a Development and Deployment SaaS%

Link
Paul M. JonesMLAPHP and N+1 Books: Half-Price Sale Starts Early! (20.3.2015, 14:02 UTC)

I said a couple of days ago that the “Modernizing” and “N+1″ half-price bundle would go on sale Monday, but I finished sooner than I expected, so I’m starting the sale today. Go get the bundle here:

https://leanpub.com/b/mlasn1php

I also said that the price would be $23.99 ($39.99), but I did my math wrong. It’s actually $22.99 (suggested $28.99).

I love it when a project is early and under-budget!

Link
Bernhard SchussekManaging Web Resources with Puli (20.3.2015, 09:05 UTC)

Yesterday marked the release of the last beta version of Puli 1.0. Puli is now feature-complete and ready for you to try. The documentation has been updated and contains all the information that you need to get started. My current plan is to publish a Release Candidate by the end of the month and a first stable release at the end of April.

The most important addition since the last beta release is Puli’s new Web Resource Plugin. Today, I’d like to show you how this plugin helps to manage the web assets of your project and your installed Composer packages independent of any specific PHP framework.

What is Puli?

You never heard of Puli before? In a nutshell, Puli is a resource manager built on top of Composer. Just like Composer generates an autoloader for the classes in your Composer packages, Puli generates a resource repository that contains all files that are not PHP classes (images, CSS, XML, YAML, HTML, you name it). You can access these resources by simple paths prefixed with the name of the package:

echo $twig->render('/acme/blog/views/footer.html.twig');

The only exceptions are end-user applications, which have the prefix /app by convention:

echo $twig->render('/app/views/index.html.twig');

Read Puli at a Glance to get a better high-level view of Puli’s features.

Web Resources

Some resources – such as templates or configuration files – are needed by the web server only. Others – like CSS files and images – need to be placed in a public directory, where browsers can download them. I’ll call these files web resources or assets here.

Puli’s Web Resource Plugin takes care of two things:

  • installing web resources in their public location;
  • generating the URLs for these resources.

The public location for installing resources is called an install target in Puli’s language. Puli supports virtually any kind of install target, such as:

  • the document root of your own web server
  • the document root of another web server
  • a Content Delivery Network (CDN)

Install targets store three pieces of information:

  • their location (a directory path, a URL, …)
  • the used installer (symlink, copy, ftp, rsync, …)
  • their URL format

The URL format is used to generate URLs for the resources installed in the target. The default format is /%s, but you could set it to more elaborate values such as http://cdn.example.com/path/%s?v3.

Creating an Install Target

Let me walk you through a simple example of using the plugin for a typical project. We will work with the following setup:

  • the application’s assets are stored in the Puli path /app/public
  • the assets of the “acme/blog” package are stored in /acme/blog/public
  • all assets should be installed in the directory public_html

Before we can start, we need to install the plugin with Composer:

$ composer require puli/web-resource-plugin:~1.0
Make sure “minimum-stability” is set to “beta” in your composer.json file:

Truncated by Planet PHP, read more at the original (another 9014 bytes)

Link
PHP ClassesImproving the use of a MongoDB database with the help of Symfony Listeners (20.3.2015, 07:10 UTC)
By Joseluis Laso (aka Patrick)
Sometimes applications need to filter large amounts of information to show to the user a small subset of relevant data.

However, when the amount data to filter is too large, it may not be feasible to filter the information retrieving the whole data into memory.

Read this article to learn about an alternative approach using a MongoDB document and Symfony listeners to limit the amount of data that needs to be traversed in memory.
Link
Nomad PHPGetting Started with Aura (20.3.2015, 05:00 UTC)

June 2015 - EU
Presented By

Chris Tankersley
June 18, 2015
20:00 CEST

The post Getting Started with Aura appeared first on Nomad PHP.

Link
LinksRSS 0.92   RDF 1.
Atom Feed   100% Popoon
PHP5 powered   PEAR
ButtonsPlanet PHP   Planet PHP
Planet PHP