Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Improving Documentation
  • To you core developers of Fuel:

    When you saw the title of my question did you roll your eyes? or get excited?

    Months ago I set out to find and learn a framework. I quickly discovered that the
    most recommended was Laravel (silly name). I spent a lot of time digging into
    it last week and yesterday I was going to install it on my Fedora desktop and
    get the first thing working (partially succeeded).

    They are doing too much (too complicated and heavy), too cutting edge
    (can't run it on RHEL 7) and it keeps changing too fast.

    So I searched again and discovered FuelPHP. The only drawback I read
    about was less than stellar documentation.


    This weakness can be turned into a strength fast if at least two core developers
    embrace noobies with a new attitude:

    That only the new user can give the best insight into what is lacking in the
    documentation. Each of us are only a new user once. Once we get past the
    initial difficulties, we look at the documentation and it looks perfect, we can't
    see what's missing.

    I was up until 1 in the morning last night trying to read a record out of a database.
    I failed and went to bed exhausted. I would like to describe my struggles, all
    of which would not have happened with better documentation. This is long but I
    would like to share it before I figure out everything and lose the noobie insight:


    There's no example for a model. I know it would be tricky to really read from a
    database but you could hard code some data in model/welcome.php and give
    examples of what a class could look like reading using different db's and libraries.

    Laravel says that most models match up with a single database table.
    Of course that is way to simplistic and suggesting that approach totally
    skips over the awesome power of a RDBMS ("join"). A discussion of the sweeping
    variety of what a model can include and do, may be helpful to many Noobs.

    There are way too many "web developers" who think a database is a glorified
    folder full of files or a fancy text file.


    I've been coding php for over 10 years but I'm new to using Classes. The
    documentation assumes that I understand classes but it would be helpful
    to explain them a little more.

    The sample code for a Model class left me wanting more details about what's
    expected for C.R.U.D. interfaces. I later realized that it's free-form: I can have
    several variations of a read method/function which suit's the table and how I
    use it. That freeform aspect while obvious to Fuelers, is not to obvious to a noobie.

    I still don't know how I'm going to get the key value into the controller
    but am assuming that it will be obvious once I get that far. Perhaps the
    controller or model topic could touch on that.

    The model topic did not make it clear whether the DB class is a standard one
    documented on Php.net or part of Fuel. I tried the code and am still sorting
    through a slew of errors.

    I found the documentation of DB but it's still not clear. Again, I'm new to classes
    so I need the doc examples to include:

    use \Fuel\Core\DB;

    So I don't have to figure that out the hard way.


    I still haven't figured out how to get the DB configured. The release (1.7.3) doesn't
    match the documentation when it comes to where to configure the database.

    Where do I set: default, development, production.

    I'm trying to debug it and find it frustrating, I'm going to have to write my own
    debugging facility to view an array from a model. How would a Fueler do it?

    The app/config/production/db.php file didn't have the type element. I tried adding
    it and DB still can't find the type.

    It's really tempting to just add a basic global config for postgresql and use
    my own code with pg_query, etc, but I want the security benefits of using your
    methods (prepared queries etc).

    One of the reasons I abandoned Laravel was because I liked what I learned on
    the ver 4 tutorial but 5 was very different and they have migrations and seeding
    and it gets very complicated and I don't need those. Fuelphp hits the sweet spot
    in what you are trying to accomplish. And it can run it on Centos 6 (running on my
    two servers).

    As I was trying to learn Fuel and debug my mod_rewrite issue, I was wondering
    how routing worked and think it should be touched on in MVC topic.

    Also I found a tutorial which pointed out that bootstrap is included but I don't see
    that mentioned anywhere.


    Thank you very much for a great system. I've always used php the slow way
    so I can customize everything but I like your philosophy of keeping Fuel backend
    only. I really need to be faster at creating things. And the MVC model will allow my
    employee to design the bootstrap frontend while I focus on the database and php.

    To embrace noobies, there should be a form at the bottom of every help topic which
    says:  "If this topic did not answer all your questions, please enter them here."

    Thank you very much for your help.
  • The problem with documentation is always that you need:
    a) a lot of time
    b) to be able to look at it as an outsider

    We used to have someone in charge of documentation, but he left the team. The two main developers both have (had) health issues, so the limited time they had available wasn't spend on improving documentation.

    Documentation that, as you rightly said, lacks support for beginners. This has a reason, the framework founder didn't want to provide support to beginners, and made a conscious effort to deter them by not proving this documentation, something that we have struggled with ever since.

    The DB documentation has my attention, I've started rewriting them to provide better support for specific RDBMS platforms, such as Postgresql. I'll keep your remarks in mind when I do.

    Having said that, please ask your questions here if you have them, or contact one of us directly on IRC (#fuelphp on freenode).

    As for classes, you don't access the the core classes directly. All core classes are aliased to the global namespace, so you can extend any core class in your app. So don't use

    use \Fuel\Core\DB;

    You can just use DB when your class isn't namespaced, or \DB ( or use DB; ) when your class is.

  • Thanks for the history. Documentation is always a challenge.
    I know I was very wordy but recording it here preserves some my "outsider perspective".

    I tried \DB; and for some reason it didn't work. Not worried about it now.

    I have the app working with basic MVC setup. I appreciate Fuel's approach of being a
    backend framework and leaving the frontend totally freeform.

    I'm not sure I want to tackle ORM but generate scaffold is very tempting. Are there any
    other templates it supports besides ORM? (If I'm understanding it correctly...)

    I have an old set of procedural routines I wrote years ago to work with postgresql tables.
    I'm trying my hand at splitting them into Model and View so I can use them from Fuel.

    Another suggestion for the docs: maybe add a few links to php.net for basics like
    objects, etc when it will help a newbie get up to speed. There has to be more people
    like me who have experience with procedural php but not objects or other advanced features.

    thanks
  • When it comes to Models there are three options:
    - use ORM
    - use Model Crud (which uses direct db calls)
    - code your own model

    The first two are supported by scaffolding, you can use a commandline switch to indicate which one you want to use.

    If you want to code your own model, you'll have to look in the scaffolding code which Model methods are called ( won't be that many, stuff like get() and save() ) and how properties are set. Make sure your models are API compatible with that, and you should be able to slot your own models in without any problems.

    I'll have to think about your suggestion. It is indeeed assumed that you know object oriented PHP. Perhaps add a "pre-requisite" page with some guidelines to knowledge required, and info on where to find that?

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion