Quantcast
Channel: PHPDeveloper.org
Viewing all 1515 articles
Browse latest View live

SitePoint PHP Blog: Installing and Securing Jenkins

$
0
0

The SitePoint PHP blog has posted the first part of a new series of articles showing you how to use (and secure) Jenkins, the popular continuous integration tool, to bring more quality to your PHP-based applications.

Earlier this year, I wrote an article about PHP-CI, which you can use as a continuous integration tool for your PHP projects. Within this article I indicated I still liked Jenkins the most as a CI tool. Time to dive into Jenkins and see how we can set this up for our PHP project.

In this first part of the series helps you get Jenkins installed via a package and configure it on the server. He then gets into the steps to secure the installation: configuring users, turning off signups and the type of security to set up (they choose matrix-based). He wraps up the article with a look at installing some useful plugins and using a template to use as a base for setting up your projects.

Link: http://www.sitepoint.com/installing-securing-jenkins/

Community News: Latest PECL Releases for 12.02.2014

$
0
0
Latest PECL Releases:
  • strict 0.4.0 add strict_cast function

  • swoole 1.7.8 - Fixed swoole_http_server::on no implementation parent class methods - Fixed cannot read cookie in swoole_http_server - Added swoole_http_server support to POST RawContent - swoole_timer_after interface can pass a user parameter - swoole_client->recv and onReceive zero copy - Fixed swoole_table->set cannot be set more than 64K string - Fixed open_length_check connection memory buffer is not reset bug - Added dispatch_mode=4/5, dispatch data by client ip and uid - Event callback function exception error level changed from E_WARNING to E_ERROR

Community News: Packagist Latest Releases for 12.02.2014

$
0
0
Recent releases from the Packagist:

Jani Hartikainen: How to make your code self-documenting?

$
0
0

In this new post to his site Jani Hartikainen suggests a few things you can do to help make your code "self-documenting" and more readable down the line (or for other developers).

Isn't it fun to find a comment in code that's completely out of place and useless? What if you could write fewer comments and still keep the code easy to understand? One of the primary ways to do this is making your code-self documenting. When code is self-documenting, it doesn't need comments to explain what it does or its purpose, which is great for making the code easier to maintain. As a bonus, with fewer comments, it's less likely they'll be crap! In this article, I will show you several ways you can make your code document itself.

He breaks it up into a few different sections, each with some code examples and descriptions:

  • Naming things
  • Extract functions
  • Introducing variables
  • Defining class and module interfaces
  • Code grouping

He finishes up with a few smaller tips including "don't use strange tricks" and "use named constants". What do you think makes for good self-documenting code? Share some of your own thoughts on the post.

Link: http://codeutopia.net/blog/2014/12/01/how-to-make-your-code-self-documenting/

Rob Allen: A few Phing tips

$
0
0

Rob Allen has shared a few Phing tips in the latest post to his site today. Phing is a PHP-based automation tools most popularly used for the deployment and configuration of PHP applications.

Following on from my last post, here's a few other Phing things that I've found helps me.

He shares three short but useful tips:

  • Hiding targets from Phing -l
  • Main target vs subtarget
  • List available targets by default

Each tip includes the XML markup you'll need to make it functional. You can find out more about Phing and what it's capable of on its website.

Link: http://akrabat.com/php/a-few-phing-tips/

Derick Rethans: Code Coverage: The Present

$
0
0

Derick Rethans has posted the first in a series focusing on the Xdebug tool and the code coverage functionality it can provide via PHPUnit's testing. In this first post he catches the reader up on the current state of things and what all the Xdebug tool can do.

Since ages Xdebug has provided code coverage support for PHPUnit, a way to show which lines are covered by your test cases. But I never really wrote about how it works. A recently filed bug prompted me to write this post, as well as a follow up post on Code Coverage's future.

He starts off with the early days of Xdebug, how it hooked into the Zend Engine (that powers a lot of PHP behind the scenes) and when it was triggered. This came with its own set of problems so Xdebug was updated to overload some opcodes. He talks about how it can calculate the unused lines and determines which lines can be covered in the code coverage results. He provides some example code showing the execution of the coverage report on a simple function and try/catch handler, complete with the HTML output of the results.

Link: http://derickrethans.nl/code-coverage.html

Anthony Ferrara: A Point On MVC And Architecture

$
0
0

Anthony Ferrara has posted another in his series looking at MVC as a design pattern and as an idea for building web applications. In this latest post he goes on to make a point about MVC, how it relates to architecture and CRUD.

Last week I post a post called Alternatives To MVC. In it, I described some alternatives to MVC and why they all suck as application architectures (or more specifically, are not application architectures). I left a pretty big teaser at the end towards a next post. Well, I'm still working on it. It's a lot bigger job than I realized. But I did want to make a comment on a comment that was left on the last post.

He responds to the comment (essentially that CRUD is a solved problem) and where the need for customizations is needed. He suggests what the real problem is, though: the three classes of developers - CMS users, custom developers and users of both.

Link: http://blog.ircmaxell.com/2014/12/a-point-on-mvc-and-architecture.html

Voices of the ElePHPant: It's the Booze Talking - ZendCon 2014

$
0
0

The Voices of the ElePHPant podcast has posted the latest in their special conference-recorded "It's the Booze Talking" series of episodes (this time it was at ZendCon 2014). In this new episode Cal Evans talks with guests Jeremy Mikola, Mike Stowe, Derick Rethans and Beth Tucker-Long.

They discuss the life of a developer evangelist including travel experiences, what it's like working conferences, and how it has an impact on their family life. They also all share their worst travel story in the course of their work and what they really enjoy about their roles.

You can listen to this latest episode either through the in-page player or by downloading the mp3 directly. If you enjoy the show and want to hear more episodes like this (or their usual community interviews), be sure to subscribe to their feed

Link: http://voicesoftheelephpant.com/2014/12/02/its-the-booze-talking-zendcon-2014/

Hack Blog: Async - Cooperative Multitasking for Hack

$
0
0

On the Hack blog there's a new post talking about async, a feature in Hack that allows for code to "cooperatively multitask". This gives the language a way to keep moving on in the execution without having to wait for things like database queries or remote file fetches to finish.

This is somewhat similar to threading, in that multiple code paths are executed in parallel, however it avoids the lock contention issues common to multithreaded code by only actually executing one section at any given moment. "What's the use of that?", I hear you ask. You're still bound to one CPU, so it should take the same amount of time to execute your code, right? Well, that's technically true, but script code execution isn't the only thing causing latency in your application. The biggest piece of it probably comes from waiting for backend databases to respond to queries.

She gives the example of pulling in a remote file (HTTPS, where there's a bit more latency) and how to use async, await, WaitHandle, and Awaitable to work around the timing issue. She shows how to make a method asynchronous and how to join the results of the operation back up with the rest of the script. This includes the use of various "handles" including RescheduleWaitHandle, SleepWaitHandle and the AwaitAllWaitHandle. She shows the integration of a custom cURL handler that makes use of this processing, marked async, to multithread the requests to the remote server(s).

Link: http://hhvm.com/blog/7091/async-cooperative-multitasking-for-hack

Loosely Coupled Podcast: Episode 15: Mental Health in the Tech Industry

$
0
0

In the latest episode of the Loosely Coupled podcast, Episode #15: Mental Health in the Tech Industry, hosts Jeff Carouth and Matt Frost talk about mental health issues, their own personal experiences with it and some of the work that's being done to help and address it in the industry.

In this episode, Jeff and Matt discuss mental health, a very important and very personal topic. There is a lot of great work being done right now in our industry to bring awareness to issues of mental health including > prompt by EngineYard, Open Sourcing Mental Illness by Ed Finkler, and #HackTheStigma, among others. This discussion talks about our thoughts on the topic in general as well as gets into personal experiences.

You can listen to this latest episode either through the in-page player or by downloading the mp3 directly. If you enjoy the show, be sure to subscribe to their feed to get the latest shows as they're released.

Link: http://looselycoupled.info/blog/2014/12/05/episode-15-mental-health-in-the-tech-industry/

SitePoint PHP Blog: More Useful Jenkins Plugins for PHP Projects

$
0
0

The SitePoint PHP blog has posted the latest article in their Jenkins + PHP tutorial series (part four) with a look at some other useful plugins for use in your projects.

In the previous articles in this series, we set up Jenkins and our project and did an analysis of the first few builds. So far, we have seen interesting results come back regarding the quality of our project. In this article, we are going to take a look at some more tools and plugins which we can use for inspecting the front end assets.

The list includes tools for evaluating a wide range of technologies involved in web development like:

  • CSSLint
  • JSHint
  • Open tasks (aka @todo)

Each tool has an example of what the output looks like and how to integrate it into the Phing build and in the Jenkins setup.

Link: http://www.sitepoint.com/useful-jenkins-plugins-php-projects/

Community News: Latest PECL Releases for 12.09.2014

$
0
0
Latest PECL Releases:
  • ev 0.2.13 Issue #11: pecl install ev command fails with non-standard PHP installation prefix.

  • stomp 1.0.6 - Add two new ini options stomp.default_username and stomp.default_passowrd (Pierrick) - General performance improvements (Pierrick) - Fix stomp_read_frame when buffered (Pierrick) - Fixed bug #59217 (Connections to RabbitMQ via CLI). (Pierrick). - Fixed bug #59970 (acking a message makes rabbitmq disconnect the server). (Pierrick) - Fixed bug #67170 (Disable Nagle's Algorithm with TCP_NODELAY, it delays sending small messages). (Yarek Tyshchenko) - Fixed bug #68497 (Stomp client doesn't parse ERROR response on CONNECT). (Lorenzo Fontana) - Fixed bug #64671 (Add stomp_nack and Stomp::nack functions). (Pierrick)

  • strict 0.4.1 updates for 7

  • mqseries 0.14.1 - Fixed bug #63563. (Segfault when using lib64)

  • graphdat 1.0.4 Stable release, linux based platforms only

  • couchbase 2.0.2 This is a patch update to the PHP 2.0 SDK. Changes: * PCBC-310: Corrected segfault occuring in some cases when running under Apache and IIS. * Updated PHP script executer to provide accurate error information in Exception stack traces. * Refactored code base for better maintainability.

Community News: Packagist Latest Releases for 12.09.2014

$
0
0
Recent releases from the Packagist:

Voices of the ElePHPant: Interview with Rafael Dohms

$
0
0

The Voices of the ElePHPant podcast has posted its latest episode in its series of community interviews. In this new episode host Cal Evans talks with Rafael Dohms, well-known PHP community speaker and founder of the Amsterdam PHP User Group.

They talk about his work with the user group, how it's currently going and the new things they're doing to draw more people into the group. They also talk about the Netherlands region and the up-and-coming speakers and talent coming up in the area. They also talk some about Rafael's "Object Calisthenics" talks and the ideas behind it.

You can listen to the full interview either through the in-page audio player or by downloading the mp3. If you enjoy the interview be sure to subscribe to their feed.

Link: http://voicesoftheelephpant.com/2014/12/09/interview-with-rafael-dohms-3/

Rob Allen: Validating JSON with ZF2's ZendValidator

$
0
0

Rob Allen has a quick post today showing how to use the ZendValidator component from Zend Framework 2 to handle JSON validation.

Let's say that you have an admin form where the user can enter JSON and you'd like to validate that the JSON parses before allowing the user to submit. To do this, you can use the rather excellent jsonlint project by Jordi Boggiano. Obviously, add it via Compser.

He starts with a quick example of using the "JsonParser" in isolation to validate a JSON string. Then he integrates it into the framework as a custom validator class (extending the AbstractValidator) and enabling the "isValid" call to be made and return a pass/fail result. You can find out more about the ZendValidator component in this page of the Zend Framework manual.

Link: http://akrabat.com/zend-framework-2/validating-json-with-zf2s-zendvalidator/

Derick Rethans: Parallelizing document retrieval

$
0
0

In his latest post Derick Rethans shows how to parallelize document retrieval from a MongoDB database via PHP. This makes it possible to speed up the read operation caused by reading each item one at a time.

MongoDB 2.6 has a new feature that allows you to read all the documents from one collection with multiple cursors in parallel. This is done through a database command called parallelCollectionScan. The idea behind it is that it is faster then reading all the documents in a collection sequentially.

He includes an example snippet that enables the "parallelCollectionScan" handling for a "cities" collection and the resulting output. He shows how to manually create MongoCommandCursors (or let the driver do it for you) and use PHP's own MultipleIterator to process all of the cursors at essentially the same time.

Link: http://derickrethans.nl/parallelcollectionscan.html

SitePoint PHP Blog: Using Traits in Doctrine Entities

$
0
0

On the SitePoint PHP blog there's a recent post showing you how to use traits with Doctrine entities. PHP's traits allow for the inclusion of functionality into a class without having to extend another class or create an object to use it.

Since PHP 5.4.0, PHP supports a pretty way to reuse code called "Traits" - a set of methods that you can include within another class in order not to repeat yourself. You can read more about traits in previously published SitePoint posts: here, here and here. Today, I am going to show you how they can be used with Doctrine ORM in a Symfony Environment.

He shows how to create two basic Doctrine entities, in this case representing "Article" and "Comment" instances. He then creates the trait, a "TimestampableTrait" class that abstracts out the setting/updating of the create and updated date on the Doctrine record. He refactors the entities to use the trait and shows the results of the "schema create" command.

Link: http://www.sitepoint.com/using-traits-doctrine-entities/

Jordi Boggiano: Composer 1.0 alpha9

$
0
0

In this new post to his site Jordi Boggiano talks about the tagging of the 1.0 alpha9 release of Composer and some of the updates that will be coming along with the release.

I tagged Composer's 1.0.0-alpha9 release yesterday and wanted to write down a more detailed update on the highlights of this release. It includes many changes as the last tag was almost one year old. You can also check the full changelog if you want more details.

The updates (so far) include:

  • Requiring packages from CLI just got easier
  • Installing dependencies on the wrong environment is now possible
  • You now get warnings when installing abandoned packages
  • Custom composer commands via scripts
  • Autoloading tests and related files
  • Performance improvements

He also includes a brief note of thanks to all of those that have contributed to the project and for the support from Toran Proxy customers to help pay for the time he spends working on the tool.

Link: http://seld.be/notes/composer-1-0-alpha9

Three Devs & A Maybe Podcast: Episode #51: Midweek Random Rambles

$
0
0

The Three Devs & A Maybe podcast, hosted by Michael Budd, Fraser Hart, Lewis Cains and Edd Mann, has posted their latest episode - Episode #51: Midweek Random Rambles.

In our 51st podcast we temporarily revert to a midweek recording of the show. This essentially means we were all a bit tired and delirious, leading to some fantastic randomness, none more than Lew's 'different' introduction to the show. We will let you be judges of that! Following our usual discussion of how things are panning out in our working week, we then move on to discuss some of the interesting security issues cropping up on Michael's university course. Also, Fraser has landed an exciting new job in London, Lew has found front-end dependency bliss with Bower and Edd is doing some exciting stuff at work too. We also talk about asset file compression/concatenation and issues we've encountered with those too. So... plenty to discuss, in fact too much to cram in to our usual hour so we will continue the theme next time. Enjoy folks, and as ever, thanks for listening and for your feedback.

Other topics mentioned in this episode include the Google no CAPTCHA reCAPTCHA, the Gitminutes podcast and new book covering domain driven design in PHP. You can listen to this latest episode either through the in-page audio player or by downloading the mp3. If you enjoy the show, be sure to subscribe to their feed too!

Link: http://threedevsandamaybe.com/midweek-random-rambles/

Reddit.com: Composer files being indexed by Google

$
0
0

In an interesting thread on the /r/php subreddit on Reddit.com, a user noticed that Google is indexing Composer files that are in the document root of PHP applications. These files, like "composer.json" and "composer.lock" can provide detailed information about which packages and libraries are in use in the application (information disclosure).

The problem is that these files are placed in the web root of the application and not in a folder one level up, a recommended practice. The post links to a Google search that shows an example of current sites with the issue.

Another comment in the same post also reminds users not to have things like their ".git" files in the document root either as they can provide valuable information to would be attackers about your application's code. Things can be done to prevent direct access to these files in the web server configuration but it's far better to restructure the application to have them in a parent directory of the actual web root.

Link: http://www.reddit.com/r/PHP/comments/2ourf7/composer_files_being_indexed_by_google/
Viewing all 1515 articles
Browse latest View live