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

Colin O'Dell:
The Journey to 1,000,000 Downloads
Aug 07, 2017 @ 11:55:33

On his site Colin O'Dell has a new post about a major milestone one of the packages he supports has crossed - the 1 million download mark. His post doesn't talk about how amazing the package, league/commonmark, is or even what it has to offer but about the process of getting there and the community support that made it possible.

This morning I came into work to find my Packagist download counter had rolled over: league/commonmark now has over 1,000,000 downloads!

To celebrate this milestone I thought I'd share the story of how this package came about, how it's grown, and how I couldn't have reached this milestone without the PHP community's help.

He talks about the initial creation of the package, its early days and how it was invited to become a part of the PHP League group of packages. He talks about improvements made to the package since then, including some integrations with other tools and projects. He then ends the post with thanks to the community for the support and their efforts to help make this package and all of them that make up the PHP ecosystem possible.

tagged: onemillion downloads commonmark community support packagist

Link: https://www.colinodell.com/blog/201708/league-commonmark-1-million-downloads

Colin O'Dell:
Optimizing league/commonmark with Blackfire.io
Jan 06, 2016 @ 12:47:38

Colin O'Dell has a post to his site talking about how he used the Blackfire.io service to optimize league/commonmark, a library that's a part of The PHP League making it easier to work with Markdown content in PHP.

As you may know, I am the author and maintainer of the PHP League's CommonMark Markdown parser. [...] This last goal [of being well-written and super-extensible so that others can add their own functionality] is perhaps the most challenging, especially from a performance perspective. Other popular Markdown parsers are built using single classes with massive regex functions.

He shares some brief benchmarks of parsing the same document with four different parsers, including an older version of CommomMark (coming in last, unfortunately). With the goal of optimization in mind, he tried out the Blackfire.io service to locate the bottlenecks in his library. Based on the results from the tests he found two optimizations that could be made relatively easily: switching from single-character parsing to regex and more correctly replacing newlines with breaks where needed.

tagged: commonmark blackfireio profile phpleague package markdown

Link: http://www.colinodell.com/blog/2015-11/optimizing-league-commonmark-blackfire-io

SitePoint PHP Blog:
Building a Micro Markdown API App with Lumen
May 12, 2015 @ 10:35:57

The SitePoint PHP blog has a new tutorial posted showing you how to create a small API service with Lumen, the recently released microframework from the creators of Laravel. Their example service takes in Markdown content and translates it to be returned as JSON.

If you’ve been using Laravel for a while, you know that it sometimes feels a little heavy for a small application or service. For that same purpose, Taylor, the creator of Laravel built Lumen. A small micro-framework built on top of Laravel Illuminate components, it doesn’t load all the components by default like Eloquent, Blade, Middleware, etc, remaining light as it boots up. We will explore all of that this short tutorial. [...] To illustrate a practical use case for the micro framework, we will be creating a Markdown parser API application where the user can submit a Markdown text and get back the parsed content as JSON. I will be using the league/commonmark package from the PHP League.

They walk you through the installation of a Lumen instance (via Composer) and how to build out the folder structure for things like resources, database configuration and views. They then include the code for the route and controller to take in the Markdown content and translate it out to HTML as a first step. Then they use the same functionality and return the HTML result as a JSON document. Also included is a simple few line call with Guzzle to the API to pass in a Markdown file and fetch the result.

tagged: tutorial markdown lumen microframework commonmark translate api microservice

Link: http://www.sitepoint.com/building-micro-markdown-api-app-lumen/