The New Myth family: SprintPHP Bonfire Practical CodeIgniter 3

New Myth Media Blog

Serving the New Myth Media Family.

Practical CodeIgniter 3 Released

My new book about making the most of CodeIgniter 3 is out!

Work on the next release of Bonfire is well under way and we have some exciting things in the process. Today I want to highlight 3 of the largest changes that are being made since they will affect anyone who decides to work off of the latest develop branch. Note that because of these changes, upgrading from earlier versions is difficult, at best. It is recommended that this version be used on new projects.

New Folder Structure

To better aid in security and ease of upgrading, we've implemented a completely re-arranged folder structure for Bonfire. It separates out the core Bonfire as much as CodeIgniter will let us, and keeps your application separate from Bonfire. This makes upgrading Bonfire in the future much simpler since it's all contained in its own folder.

We've also moved the core, your application and modules out of the webroot for the enhanced security that comes with making your files harder to get to. It's a small thing, but we think it helps keep your apps even more secure in the long run, which is good for everyone.

You can find the details over at the wiki.

More secure passwords

Keeping with the theme of security, we have moved the Auth library and all users to use phpass for the password encryption. This provides a much more difficult to hack password encryption scheme on a number of levels.

Note that during an upgrade of a site, all users are set to have their passwords reset on their next login. The guts are in place on this, but we're actively working on the process for the user during the login to actually detect that it needs to be reset and prompts them to reset it. That should be in place shortly.

Better Admin Theme

While Bonfire has always looked alright, I've never been overly happy with the design. It never held that polish and shine of a pro app. We're getting ready to change all of that. After I made a comment asking if we had any designers in the house, Bogdan Lazar stepped forward and has graciously offered his help to come up with a new look for the Bonfire admin area. The goals are to create something clean and professional that is even more well-suited to putting a professional face on your web applications. We're just in the beginning stages of the design, but I am very excited about the possibilities. Keep an eye out for screen shots in the next few weeks.

While you will see changes to the theme in the current develop branch, they are not the final theme. They were what I was working on when I got an offer from Bogdan to work with us so kindly ignore that for now. :)

Smaller Things

Cronjobs

Work is nearly completed on a new Cronjobs module that allows your modules to easily create cronjobs that can be scheduled to run just like a typical Unix-style cronjob. Note that you'll still need to setup the full cronjob to run Bonfire's module, but that single cron will trigger all of your site's cronjobs, when necessary throughout the day. Besides being very flexible, this helps overcome restrictions on the number of cronjobs that can be ran by a number of hosts.

More robust installer

The installer has had a number of new checks added to it and made a little clearer and more usable. We know there's still more to do there, but we're getting closer.

More thorough language support

Many loose strings have been hunted down so the site can be even more localized. We also have a French translation in the works, now.

Database independence work

Much work has been made in removing any MySQL specific code to use CodeIgniter's ActiveRecord for more database independence. We have found some limitations in CodeIgniter's support for other database features. For Example, while the installer supports setting you up with a MySQLi driver, the driver doesn't support creating backups so that feature is now broken when this driver is used. We're looking at ways to get around this or even help CI upgrade their driver, but it's going to take a while.

And more...

Many bugfixes have been done and are being hunted down. Documentation is still getting written. Work is always continuing on the project, so if you'd like to get involved and help with either of those areas, we'd love to have your help!

As of today, all documentation for the 0.6 branch on will be hosted on the GitHub Wiki.

Why are we doing this? Because we'd love to see more complete, accurate documentation, just like you would!

There have been a couple users recently contribute to documentation in our "old" repo and that is awesome. But we recognize that forcing you to download another repo, install PieCrust, make the changes, submit a pull request, then wait for us to integrate and push to the live site is... whew! a lot to go through. It is our belief that moving the documentation to the Wiki will allow any of our users to correct out-of-date information, add new pages, etc so that Bonfire's documentation can continue to grow and support the best CodeIgniter-based kickstart to your project around.

Don't worry, though, this doesn't mean that we're going to stop contributing to the documentation. Instead, this makes things easier for us to do it, also.

Future Releases

We've also created a new folder within the wiki called 0.7 that, surprisingly enough, holds the revised documentation for the 0.7 branch, that is just getting started. When you add a feature, or modify an existing feature, and your pull-request has been approved and integrated, please help out by taking the time to update the 0.7 documentation.

We are looking into simply providing the files as part of the repo, and would love to hear your thoughts on that. I think it might make getting pull-requests with documentation updates even simpler for everyone involved. What do you think?

It’s been a long slog to get here, with the team ebbing and flowing between busy jobs and new team members, but the Bonfire Team is thrilled to announce that version 0.6 is ready for the prime time.

However, we couldn't have done it without the awesome commits that have come in from the community as a whole. This project isn't just ours... it's building a tool we all can use to make our lives easier. And you all have done a fantastic job of helping to make that tool better. Thank you so much for everything.

Ch-ch-ch-changes

The new release brings a massive truck load of changes, both under the hood and visually. So let’s take a quick look at some of the bright new shinys that you’ll get to start your projects on now.

When we started working on this release one theme seemed to keep coming back to us: If it’s going to be changed, let’s change it now and get it set the way we want it so that we have an awesome base to build on. We believe we’ve managed to do this and create a much more flexible, powerful base for your new applications. As we’ve built more apps based on the current code, changes keep getting made to make those projects not only possible, but a delight to work with. We hope you like it.

Facelift

Whlie the old UI of the admin area had it’s own type of charm, we felt it was time for something new. Something that had taken the development world by storm and was a library that has many of the things you need for a brilliant site already built in.

Say Hello to Bootstrap.

Twitter’s Bootstrap library has been used in both the default and admin themes, bringing a whole new look and feel to your apps. It’s something a bit more traditional-feeling than what used to be there. Moving to a whole new look does make upgrading your 0.5.x-based sites pretty tough, we realize that. But we think it’s worth it.

Settings

It used to be that a lot of settings existed in the application.php config file. While that worked for many instances, it was a bit of a pain when it came to securing your application and forcing you to keep the config file writeable. So we removed a number of those and put them into the database where they’re much easier to get to from the user’s view point.

That meant that a new way to access your settings were needed. Enter $settings_lib. This new library is modeled after CodeIgniter’s Config library so you should feel right at home.

Code Builder

In previous versions we had the Module Builder. And it worked great to build a starting point for a new module very quickly. We realized, though, that it’s not enough. It could do more. This release features the first baby steps in expanding the possibilities and introduces a new Context Builder that makes creating a new context a very simple thing indeed.

In future releases we plan on modularizing the Code Builder even more so that it’s easy to drop in new ‘Generators’ that plug right into the UI and can be used to build things we can only imagine right now.

User Enhancements

Users have seen a lot of attention this go around, and get a big boost in two main areas: registration and meta fields.

  • When a new user signs up at your site, you can now require that they activate their account via either email or by having an administrator approve them.
  • You can set the requirements for the strictness of user’s passwords right in the settings page.
  • Built into the user_model, you can now store and retrieve custom fields for users, like address, phone number, shirt size, or whether they think Hans shot first.

Translation Utility

We know that Bonfire is used around the world and have had a number of users do partial translations in the past. Unfortunately, the rate of change makes that difficult for volunteer translators to keep up with. So, we thought we’d make things a bit easier for you and built a translations UI that makes it simple to translate every string in every module (including your own modules!). You can even export them for other users or just for a backup.

But wait, that’s not all!

This short list highlights the major changes to the app, but doesn’t come close to telling everything. There’s been many small bug-fixes and improvements, a slew of security enhancements, and little helpful methods scattered throughout the libraries that make them a bit easier to use in your own code.

We’re thrilled to be able to release this today and get it in your hands. I can’t wait to see what you are going to create with this! (When you do, drop us a line. We’d love to post an short interview with you about it.)

What are you waiting for? Grab your copy today and get building.

This is the first in a new series of articles showcasing sites that have been built with Bonfire as the base. In this case, Project Simply built the site based on Bonfire 0.5 and did a fabulous job creating a beautiful site.

If you have a site that you'd like to have showcased, please email Lonnie at lonnieje@gmail.com.

Eposure.com home

Tell us a little bit about the team that built Eposure.com.

We're a small, boutique agency in sunny Manchester, UK called Project Simply. As lead developer, I was itching to get stuck in to Bonfire since finding out about it, and was looking for a suitable web application project to use it. I've been using Codeigniter for years, but inevitably drift into open source (Wordpress, Magento) for most of our projects as they suit a more standard site.

The core of the application was built in its entirety by just me (phew), which is not ideal, but time frames allowed for this to be the case. We had different front end devs and designers involved, but when building applications it's always better to tag team the back end, at least. Spot each other's mistakes, and the like.

Can you describe the application in general?

Exposure is a place for photographers to easily present their portfolios and CVs to the world. It's aimed a connecting freelance photographers with creative professionals such as art directors who need to employ someone for a specific task.

What are the goals of the site and the main audience?

The crux of the site revolves around the search facility, allowing creative professionals to easily find nearby photographers within a specific niche. This way the most ideal person can be found for a specific job, as quickly as possible.

The secondary purpose is to create a glitzy portfolio page for the members, with an attractive gallery to view photographs. It also needed to be super simple to use for photographers without a deep knowledge of computers.

Eposure.com profile page

What made you decide to use Bonfire for this?

I've been looking for an HMVC framework that sets me up with an admin area and secure user system for a long time. There's obviously a heap of them out there, but it was also key to find a framework that remained flexible and liberal. I can't stand it when it feels as though the framework is restricting me, and with Bonfire I found a system that would give me everything I needed, but never seemed to get in the way. Well, almost never!

What were some of the pleasure-points and pain-points when using Bonfire for this type of site?

The module builder is great. I feel almost like I'm cheating, using PHP and having something generated like that! At first I thought this would be restrictive, but once again, after the module builder did its business it was marvellously simple to amend or simply ignore the way it generated code, and do my own thing around it. The extended model class in particular gives me much joy, using find, update & insert functions without having to write anything. Terrific.

Pain points? I'd say I have grief with the standard admin layout. I'd much prefer a less awkward, more 'blank canvas' style to the system. Using boiler plate, for example. Something that is plain and doesn't need editing, but can easily be modified, just like the module builder.

Any general tips for Bonfire users you learned on this project that you'd like to share?

Work out exactly what the module builder is doing. Take a look at the extended classes in the core folder, and see what MY_Model is making for you. I know I didn't quite use everything to its full potential here, as I didn't read through thoroughly until I'd already got going. Most db interactions are covered here, it really leans up your code.

Any thing else you'd like to share?

Ooh, the activities monitor is great, and so useful for keeping track of users. It's so easy to implement too. The reporting is a bit poor though, and a simpler way to navigate by date, and do a csv export would be on my list of improvements. I know for eposure they already have thousands of pages of activities reported, and an export of this is on my list of improvements for them.

Hey, I should probably stop moaning and offer to help you out with this?

What lessons did you learn during this project?

Going back to my point about tag teaming- single handedly backend devving an application like this is a bad move. Sure, I got there in the end, but the amount of time wasting bug hunting or problem solving is just not good enough, when a fresh pair of eyes tends to spot what's going on straight away.

Also, I learnt that they Paypal API docs are the biggest steaming pile of crap I've ever encountered.

What's up next for you and your team?

We have a heap of sites being developed at the moment, and we're just finishing off an image manager/ repository for a client, built once again with Bonfire.