Paul M. JonesAura 3 Plans (27.3.2015, 15:25 UTC)

From the Aura blog:

  • The Past

    • Aura 1.x framework packages will see no new releases, and may be archived.

    • Aura 1.x library packages are near the end of active development; to prevent orphaning and end-of-life, ownership and authority over them they may be transferred to interested parties.

  • The Present

    • Aura 2.x packages that are currently stable will remain the center of development attention, with some modifications to Composer and PHPUnit support files, and with added testing on PHP 7.

    • Aura 2.x packages that are not currently stable will not see stable 2.x releases; they will become 3.x candidate packages.

  • The Future

    • Aura 3.x packages will target PHP 5.6, and additionally test on PHP 7.

    • Aura 3.x library packages will be allowed to depend on interface packages, though not other implementation packages.

    • Aura 3.x will not provide a framework under the Aura name, although the 2.x framework should be able to use 3.x components. Frameworks of Aura packages may be provided as separate projects.

    • Aura 3.x and later packages will have independent major version release cycles.

Read the entire post here.

Link
PHP ClassesCreating a PHP Daemon Service (27.3.2015, 09:51 UTC)
By Dmitry Mamontov
Daemons are special applications that can monitor and process an important activity on a machine in the background.

Read this article to learn how to create a daemon in pure PHP, handling signals, handle multiple asynchronous I/O and events with libevent, monitoring daemon performance, starting the daemon and distribute your daemon application as a PHAR archive.
Link
Anna FilinaDoctrine not saving ManyToMany (26.3.2015, 23:36 UTC)

Say you have a ManyToMany relationship, like Post <—> Tag.

// AcmeBundle/Entity/Post.php
/**
 * @ORM\ManyToMany(targetEntity="Tag", inversedBy="posts", cascade={"persist","remove"})
 */
 protected $tags;
// AcmeBundle/Entity/Tag.php
/**
 * @ORM\ManyToMany(targetEntity="Post", mappedBy="tags", cascade={"persist","remove"})
 */
 protected $posts;

When you add tags to a Post and the save the Post, everything is great. But when you add posts to a Tag and then save the Tag, the posts are not saved. Why? Because Doctrine persists changes only on the owning side of a relation. The owning side is the one that has the inversedBy.

How to fix this? Simple. If you’re accessing the Entity directly (without a Symfony form), then there is only 1 step.

1. On the inverse side (Tag), you will need to edit the following methods: addPost and removePost.

public function addPost(Post $post)
{
    $this->posts[] = $post;
    $post->addTag($this);
    return $this;
}

public function removePost(Post $post)
{
    $this->posts->removeElement($post);
    $post->removeTag($this);
}

This will keep the owning side in sync, so that persisting either the Post or the Tag will save the association. At this point, you can go ahead and clean up the cascade in the Tag entity, as it’s no longer necessary.

@ORM\ManyToMany(targetEntity="Post", mappedBy="tags")

2. If you’re using a Symfony form with a collection field to associate the posts, you need to add an extra option in your form builder:

->add('posts', 'collection', array(
    'by_reference' => false,
    //...
))

This is only needed in the Tag form (the inverse side of the relationship). If you omit this option, it will default to true and will set posts by reference. It will go fetch the ArrayCollection of posts and manipulate it directly, therefore not calling addPost/removePost that you need to keep things in sync. Setting this option to false will force the form to call these methods.

Happy coding!

Link
Remi ColletPHP 7.0 as Software Collection (25.3.2015, 17:57 UTC)

RPM of upcoming major version of PHP 7.0, are available in remi repository for Fedora 20, 21, 22 and Enterprise Linux 6, 7 (RHEL, CentOS, ...) in a fresh new Software Collection (php70) allowing its installation beside the system version.

As I strongly believe in SCL potential to provide a simple way to allow installation of various versions simultaneously, and as I think it is useful to offer this feature to allow developers to test their applications, to allow sysadmin to prepare a migration or simply to use this version for some specific application, I decide to create this new SCL.

Installation :

yum --enablerepo=remi,remi-test install php70

emblem-important-2-24.pngTo be noticed:

  • the SCL is independant from the system, and doesn't alter it
  • this SCL is available in remi-test repository
  • installation is under the /opt/remi tree
  • the Apache module, php70-php, is available, but of course, only one mod_php can be used (so you have to disable or uninstall any other, the one provided by the default "php" package still have priority)
  • the FPM service (php70-php-fpm) is available, it listens on default port 9000, so you have to change the configuration if you want to use various FPM services simultaneously.
  • the php70 command give a simple access to this new version, however the scl command is still the recommended way (or the module command).
  • for now, the collection provides 7.0.0-dev, but alpha/beta version should be released soon
  • more PECL extensions will be progressively also available
  • only x86_64, no plan for other arch.

emblem-notice-24.pngAlso read other entries about SCL.

$ scl enable php70 'php -v'
PHP 7.0.0-dev (cli) (built: Mar 25 2015 14:40:01) 
Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.0.0-dev, Copyright (c) 1998-2015 Zend Technologies
    with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2015, by Zend Technologies

As always, your feedback is welcome, a SCL dedicated forum is open.

Link
SitePoint PHPTop 10 Z-Ray Features to Check Out (25.3.2015, 16:00 UTC)

This post was written by a developer who works on the Zend Server project. We’re pretty keen on editorial independence here at SitePoint, but occasionally we feature articles from people working directly on some of our favorite tools.

Necessity is the mother of invention goes the famous saying.

For PHP developers, there is no greater need than visibility. But developers today have a tough choice to make as they develop and debug their apps. Either use crude methods such as printing, debugging information, or storing it in a log file, or - use multiple debugging/profiling tools that are awkward and require a lot of work from the developer’s side.

Either way - this means time. Time spent accessing the PHP log. Time spent accessing SQL queries. Time spent finding that one bad function or PHP error causing a bottleneck or crashing your app.

This article introduces the top 10 features of Z-Ray - an innovative new technology from Zend that makes PHP development a whole lot quicker and easier by giving developers unprecedented insight into their code - and the visibility they need to develop top-notch apps.

About Zend Server

Zend Server is an integrated application platform for mobile and web PHP apps. It includes an advanced and secure PHP stack (which is fully compatible with php.net’s PHP and based on the same source code), with over 80 popular PHP extensions and libraries.

Zend Server includes tools that help you develop, debug, deploy and monitor your PHP apps, together with advanced features for optimizing performance, scalability and reliability.

Zend Server supports Apache, NGINX and IIS Web servers, and is delivered as native packages for all leading Linux distributions, Windows, MAC OS X and IBM i environments, including Cloud environments such as AWS.

Zend Server supports any PHP code, and provides deep insight into that code, including popular PHP applications and frameworks like WordPress, Magento, Drupal, Zend Framework, Symfony, and Laravel.

See this overview for more information on what Zend Server is and how to install it.

What’s Z-Ray?

Z-Ray is a Zend Server component that monitors requests made to the Web server, and then displays all the details of a page request, across all the PHP scripts involved in building the page, in a nifty toolbar at the bottom of your browser.

Z-Ray

Continue reading %Top 10 Z-Ray Features to Check Out%

Link
Derick RethansXdebug 2.3: Improvements to Debugging (25.3.2015, 09:12 UTC)

Xdebug 2.3: Improvements to Debugging

This is the fourth article in a series about new features in Xdebug 2.3, which was first released on February 22nd.

In this article we are looking at the improvements towards "remote" debugging.


The first improvement is the addition to view the values of user defined constants. In Xdebug this works by defining another context. Existing contexts are local variables, and super globals. In PhpStorm, they show up in the same "Variables" box:

Xdebug 2.3 defines a third context, "User defined constants". This new third context also shows up in PhpStorm's "Variables" box:

However, if you have lots of constants, that becomes annoying. Follow (or comment on) issue WI-21691 if you want to see this changed.

Other IDEs, such as Komodo, handle this by having a separate tab for constants:

It is actually clever enough to create a new tab for every new context that I come up with, as they haven't hard coded it.


Another new debugging feature is to be able to set an exception breakpoint on all exceptions, by using * as the exception name. Xdebug 2.3 also breaks on exception classes that are inherited from the ones you set a breakpoint on. With the following code:

<?php
class BaseException extends Exception {}
class ChildException extends BaseException {}

echo "start\n";

try
{
        echo "first try\n";
        throw new ChildException("No noes!");
}
catch ( ChildException $e )
{
        echo "eat it\n";
}

echo "end\n";
?>

And the following exception breakpoints configured in PhpStorm:

Xdebug will now interrupt the script when it hits line 11 because an exception breakpoint for both BaseException (the parent of the exception that we are throwing) and * are configured.


The third feature that I would like to highlight is related to the additions to debugging exceptions. Xdebug now includes the exception's error code in the reply to the IDE. However, it does not seem that PhpStorm allows me to see which exception it broke on, and what its message and error code are.

For now, you will have to do with the raw XML result (after formatting):

-> run -i 6
<?xml version="1.0" encoding="iso-8859-1"?>

        
                this should still break
        


I have created issue WI-26880 in their issue tracker as a feature request.


And the last thing that has changed with debugging in Xdebug 2.3 is that now Xdebug will try to log when you do not have sufficient permissions to create a socket. For example when you have SELinux turned on but not properly configured. The new message is:

E: No permission connecting to client. This could be SELinux related. :-(


Other parts in this series:

Link
Anthony FerraraThoughts On The Design Of APIs (24.3.2015, 15:00 UTC)
Developers as a whole suck at API design. We don't suck at making APIs. We don't suck at implementing them. We don't suck at using them (well, some more than others). But we do suck at designing them. In fact, we suck so much that we've made entire disciplines around trying to design better ones (BDD, DDD, TDD, etc). There are lots of reasons for this, but there are a few that I really want to focus on.

Read more »
Link
Derick RethansXdebug 2.3: Improvements to Debugging (24.3.2015, 09:12 UTC)

Xdebug 2.3: Improvements to Debugging

This is the fourth article in a series about new features in Xdebug 2.3, which was first released on February 22nd.

In this article we are looking at the improvements towards "remote" debugging. The first improvement is the addition to view the values of user defined constants.

  • issue 406, 495, 1066, 1084 (debugging section)


Other parts in this series:

Link
Cal EvansInterview with Samantha Quiñones (24.3.2015, 05:00 UTC) Link
Cal EvansInterview with Samantha Quiñones (24.3.2015, 05:00 UTC) Link
LinksRSS 0.92   RDF 1.
Atom Feed   100% Popoon
PHP5 powered   PEAR
ButtonsPlanet PHP   Planet PHP
Planet PHP