Notejam: Easily Learn a Web Framework

The easy way to learn web frameworks

Notejam provides you with a very easy way to learn new web frameworks. All kinds of web frameworks, too:

  • PHP
  • Python
  • Ruby
  • JavaScript (node.js)

Notejam describes itself like this:

Do you know django/laravel/symfony/etc and want to try rails/flask/pyramid/etc? The easy way to start with a new framework is to compare it with frameworks you already know. The goal of the project is to help developers easily learn new frameworks by examples.

Notejam is a unified sample web application (more than just “Hello World”) implemented using different server-side frameworks. Currently most popular python, php and ruby frameworks are supported.

All implementations of Notejam are SQLite based and are launched by built-in web servers. Each implementation has steps describing how to easily install, launch, and run tests.

Notejam is developed by Serhii Komar, @komarserjio on Twitter. Notejam can be downloaded on GitHub and you can view various screenshots on GitHub, as well.

0

WordPress Tip: Specify a Primary Category using Advanced Custom Fields

What WordPress custom fields should have been

I found Advanced Custom Fields (also known as ACF) about 6 months ago while working on a project for a client. They didn’t want to have to mess around with editing the Custom Fields that come native with WordPress, it just wouldn’t have worked as smoothly.

The client needed to require one image, one PDF, one year selection, and one category. The category consisted of two options, “Weekly” or “Daily”. If you’re wondering, it was a newspaper client who wanted to categorize their posts as being either a “weekly issue” or a “daily issue”. Makes sense for a newspaper!

Getting the native WordPress custom fields to play along well with files can be tricky, and probably not worth the effort, especially with a plugin like Advanced Custom Fields around.

So, enter the hero of this post, Advanced Custom Fields. I was able to set everything up with Advanced Custom Fields within about 20 minutes, and that even counts the time that I took to make various theme templates pull data from Advanced Custom Fields. The actual setup of Advanced Custom Fields took about 2 minutes.

I’ve since started using Advanced Custom Fields here at longren.io, too. Independent Publisher, the WordPress theme I’ve been using, likes to show one main category when you’re viewing a single post, even if it’s not the most relevant category. So instead of a post about WordPress having the Git category shown at the top, I can now specify which category I want to be shown. So, for a post like this, I would obviously choose WordPress as my primary category.

I’ve already added the necessary parts to my Independent Publisher child theme, and have sent a pull request to Raam Dev to get his thoughts. It’s a very easy thing to support in a theme, however, it requires that everyone using that theme use the same field name in ACF.

I named my field primary_category, since that’s exactly what it is.

Example field setup with Advanced Custom Fields
Example field setup with Advanced Custom Fields

After you’ve added your “Primary Category” custom field, you can then use the value of that field throughout your theme. I’ll have a short post later this week on exactly how you can display the primary category value in your theme. Or, if you want to know right now, you can see this pull request at GitHub.

As you can tell, Advanced Custom Fields is a beast of a plugin. I also love that Advanced Custom Fields is totally free, which is kind of amazing to me. I’ve come across many paid plugins that are nowhere near as polished and user friendly as Advanced Custom Fields.

Advanced Custom Fields doesn’t skimp on the documentation, either. Their documentation site is extremely helpful, I never once ventured away from it while getting familiar with Advanced Custom Fields for the first time.

You can download Advanced Custom Fields from the WordPress Plugin Directory, so you can also install it in just a few clicks, right from your WordPress Dashboard! Advanced Custom Fields is developed primarily by Elliot Condon, and can also be found on GitHub.

The great thing about this is that it can be applied to any theme, not just Independent Publisher. So, if you’re not using Independent Publisher, just setup Advanced Custom Fields as I described and make the necessary changes for your theme.

A follow-up post will have more details on using data from Advanced Custom Fields, no matter what theme you’re using.

0

Receive Alerts On SSH or SFTP Logins with Papertrail

Frustration-free log management, plus a lot more

I’ve been a huge fan of Papertrail ever since I discovered it, probably about a year ago or so. I use it mostly to monitor server logs. I currently have two servers setup to send syslog messages to Papertrail.

The Papertrail Events dashboard can be a bit overwhelming at first, but the provided search is powerful and allows you to finely control which log messages you see and which you don’t.

You can even setup saved searches to fire when a specific event occurs. For example, I have a saved search that searches for the following:
Accepted publickey for tyler

When that message shows up in Papertrail, it means that I logged in, or that someone else has logged in using my SSH key. This can be quite handy, especially if you’re a one man shop like me and are usually the only person that has SSH or SFTP access to a server.

Getting a DigitalOcean VPS added to Papertrail, especially if it’s running Debian or Ubuntu, is super easy. It just requires that you modify /etc/rsyslog.conf and add a line to the end of the file that will send a copy of the system logs to Papertrail.

Papertrail can monitor application logs, too, such as Apache httpd logs and MySQL server logs, although that takes a bit more configuration to get working properly.

If nothing else, it’s just nice having system logs aggregated in one central place, where everything is easy to search through, making it easy to find exactly what you’re looking for. If you’re an admin for one server or hundreds of servers, Papertrail could turn out to be one of your favorite tools. It’s definitely one of my favorites.

I suggest you give Papertrail a try, can’t hurt, they even have a plan that’s free forever. It’s definitely a great service for monitoring server logs.

0

PHP MVC Skeleton App

A simple and easy to understand PHP MVC skeleton application

While reading about the “best” PHP frameworks of 2014 at SitePoint, I stumbled upon a little framework that will be very handy, especially where a full-blown framework may be a bit too much.

The PHP-MVC Project has two editions available, a basic version, and then an advanced version that supports Twig and automatic Saas compiling.

The developer of PHP-MVC was quoted in the SitePoint article, basically stating why he created it:

Most frameworks are simply too advanced, making it hard for non-professional developers or frontend people to quickly build good things, so I was always searching for a naked and totally stripped-down PHP barebone application. php-mvc solves this problem and reduces the learning curve to a total time of under 30 minutes while still being very professional and self-explaining.

I’ll still probably use Alto Router for really simple sites or apps, and Slim Framework for slightly larger sites.

I’ll probably never need to use the PHP-MVC skeleton application, but it’s nice to have available. PHP-MVC framework can be downloaded from GitHub, here’s the basic version, and here’s the advanced version.

1+

Belt: A Handful Of Tools For PHP Developers

Clean and well-documented source

Belt is a really handy, and relatively new tool set for PHP developers. It’s initial commit was only 9 days before the date this post was published.

However, it still looks very usable and rather mature. Code has been added at a pretty quick pace, there’s been 102 commits since Belt’s release on GitHub, a little over a week ago.

It’s release under the MIT license, so it’s compatible with the GPL and can safely used in WordPress themes and functions, if you want them included in the official repositories.

Basically, you just include belt and use it’s built in methods/functions to do certain things that would take a bit more work using straight PHP. For example, to get the maximun of an array of numbers, do this:

A value of 3 will be returned, because it’s the max value there.

And from the readme, a list of what Belt offers.

  • 60+ useful functions
  • ability to use the facade Belt or a dedicated component (e.g. BeltUtilities)
  • fully tested
  • source code is clean and documented

Seems like it offers some pretty useful functions, and it looks really easy to use. I’ve been looking for a solid PHP base to use and this may just be it. Anyone got any other suggestions? I’ve heard a lot about Skeleton for PHP.

Searching for “skeleton” on GitHub, then filtering for PHP, gives a LOT of results, over 1,000 results to be more precise. So, maybe I’ll browse there for a while before making a decision.

Any suggestions can be left in the comments.

0