Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Autoloading class on FuelPHP needed
  • I am very new Fuel user just a day that learn about fuel.. before found out Fuel i am been use to learn many framework like Zend framework 1.11.17 , Symfony2, Yii 1.1.17 and try to build my own framework by integrate Zend library with Smaty3 but not good solution because no MVC.. can use Zend controller but not interesting for me.. what i wanna told you about problem when i am using Fuel? That is not really problem of Fuel just a problem with new developer with Fuel .. Please reading carefully .. At first i am use Fuel and setting Fuel to working with Session.. I am use Session db.. and following Docs step by step for sure.. after setup session db and create session table on my DB.. let me try to test if session are working on my webapp.. Yes, session doesn't working as well.. what i doing some thing wrong with session? I do follow all docs wrote.. It's better way to use IRC #fuelphp yes they can help me as well that i must setting 'Session' class loading by manual.. Ohh.. god! Docs doesn't tell me to do this.. OK no problem try again.. No session on my session table.. what wrong? I can check that i am setting DB user already as correct info.. then i am checking config.php then see more missing.. package: orm not loading.. ok loading 'orm' then try to refresh again.. ok now session are working as well... Why FuelPHP use a system completely like CodeIgniter? you need to do manual setting package, Class, module and all what you want to work on Fuel.. all like CodeIgniter i can see..
    Why FuelPHP are not use autoloader class and package? I was discuss with some guys in IRC #fuelphp about Autoloader class on fuel.. They all way said autoloader class are using more memory loading.. Did you test it yet? or just thinking that will be? with FuelPHP
    1. session will working when you config 'classes' => array('Session') but not work with session db.. until you load package 'packages' => array( 'orm')
    2. if you want to use another class or files you also need to do manual setting them.. also Language files.. with Yii, Zend Framework, Symfony2 and my framework without MVC
    1. session are working and load automatic just setting db and session store.. file or DB?
    2. all file like language file or all class are loading automatic.. just use at all.. What about Page rendered in????s using ???mb of memory. ?
    I was try to use my own framework without MVC and all class and all language file are auto loading and i got .. Page rendered in 0.003s - 0.03s
    Autoloader class make webapp slow? Not really.. I don't see any different from page load.. but ever easy to use because every class or language files are auto loader.. don't need to setting manual to loading class or files.. and Yii, Zend Framework, Symfony2 also working like this way in autoloader class and files.. page are not slow loading. Why you not use Yii, Zend Framework, Symfony2 or your own framework?
    my own framework is good for a website with no MVC .. I wanna build my webapp with MVC but not good to build my own MVC and not easy to fine standalone MVC library class.. I am not use Yii, Zend Framework, Symfony2 because not easy to understand about their solution.. very difficult to understand a solution.. ok then choose FuelPHP, Yes! What you want?
    I just wanna know how to loading all class and all language files in simple way and easy way.. and well done .. because i don't like to do manual loading all class or language files each time... better that i can loading all class and all files .. just calling and use them .. easy way and don't worry if i am forget they name of file.. their already know by default.. You not care about memory loading?
    Autoloader class or files are not loading all file when you load page.. autoloader just let framework know where is a files or class.. and will load their class or files whenever you calling or using class or files.. then all the same concept with Fuel just load a class or files on demand but in different ways.. more easy and faster.. I think that is a good idea to do this.. because faster and easy to use FuelPHP as well.. anyway if you can't change Fuel core.. maybe let me know how to hack fuel to work as what i want to use autoloader on my webapp.. i will just use on my own risk.. or if you know any standalone MVC or HMVC class.. please show me then i may use it to integrate with my own framework.. be cause my own framework need only MVC and everything will working fine on my webapp..
  • This looks to me like a rerun of your discussion with Jelmer on IRC, and you still don't seem to get it. How does an autoloader work? As soon as you reference a class, PHP will check if that class is already loaded in memory. If so, it will use it. If not, it will pass the class to the defined autoloader method(s). After that, it will check again if it's loaded (i.e. if the autoloader did it's job), and if not, terminate with a fatal error. Fuel works exactly the same, and this functionality is built in. If you need a class, just use it, Fuel will take care of the loading, completely transparent for you as a developer. There is NO need to load anything manually, so when you compare Fuel to CodeIgniter, you obviously haven't got a clue what you're talking about! Fuel's config has an "always_load" section, which does exactly that: it forces a class to be loaded at startup, and not when first requested. The only reason for doing so is that the class your loading can have an _init() method that HAS to be executed before your page request is processed. Which is very seldom the case. When it comes to Sessions, if your application uses that, you probably use a set(), get(), or a flash method on every page request. In which case the session class is loaded, initialized, etc. No problem. If you have page requests that DOES NOT use any session class methods, then you might need to manually force the load through "always_load", to make sure the initialisation happens, the cookie is updated and expired if need be, etc. But you don't have to do that, it will still happen on the next page request that DOES use session methods. How did you come to the conclusion that Sessions don't work? You created the database table? You configured sessions to use the database? And then, expect something magical to happen? What's the point of creating a session if the page request doesn't use any session call? Because if it did, the session would have been created! There is NO relation between Sessions and ORM, so I haven't got a clue where you get that idea from. The Sessions DB driver uses direct DB calls to access the database, it DOES NOT NEED the ORM package! You're entire post (and IRC) discussion is about something Fuel does out of the box. So try to understand PHP's features and Fuel's functionality first, before assuming things don't work as (you think) it should. And then give documented examples that show us it doesn't work, and we'll fix it.
  • I tried to explain last night on IRC, but utterly failed to get it through to you - probably because of a language barier. I'll give it another shot now. First off, your topic title is nonsense: "Autoloading class on FuelPHP needed" - we've had autoloading since day 1.
    At first i am use Fuel and setting Fuel to working with Session.. I am use Session db.. and following Docs step by step for sure.. after setup session db and create session table on my DB.. let me try to test if session are working on my webapp.. Yes, session doesn't working as well.. what i doing some thing wrong with session? I do follow all docs wrote.. It's better way to use IRC #fuelphp yes they can help me as well that i must setting 'Session' class loading by manual.. Ohh.. god! Docs doesn't tell me to do this.. OK no problem try again.. No session on my session table.. what wrong? I can check that i am setting DB user already as correct info.. then i am checking config.php then see more missing.. package: orm not loading.. ok loading 'orm' then try to refresh again.. ok now session are working as well...
    First of all, you don't HAVE to add the session class to "always_load" config. It's an option which seemed to suit what you where asking, but this seems to have confused just the hell out of you. Resulting in you completely not understanding how Fuel works.
    Also you said there where problems without having added it to always_load, but I read back part of my chatlog from last night and you had far more problems than just that. You were figuring it all out and probably made some other mistakes along the way. Let me try to explain this once more (the 5th time counting last nights attempts): you don't absolutely need to add Session to always_load. The advantage of doing so is that the session class is always loaded, even when not required and thus there is always a session and the session is kept alive on each and every request. If you are already using the session on each request there's no reason at all to do this, and in most cases you won't need to do this.
    This is not weird though, as far as I know all frameworks have session libs with similar requirements.
    Why FuelPHP use a system completely like CodeIgniter? you need to do manual setting package, Class, module and all what you want to work on Fuel.. all like CodeIgniter i can see..
    Why FuelPHP are not use autoloader class and package? I was discuss with some guys in IRC #fuelphp about Autoloader class on fuel.. They all way said autoloader class are using more memory loading.. Did you test it yet? or just thinking that will be
    This is complete and utter nonsense. Everything in the core and in your app is always autoloadable (the Session class as well as I stated earlier). Fuel doesn't autoload packages, which is by design and makes for an incredible modular system without unnecessary overhead. If you want a package like "Orm" available, all you need to do is add "orm" to always_load config. Something that should take less than 20 seconds. A system like this keeps the namespace clean of any unneccessary classnames and prevents trouble when you want something with a "Orm" namespace (in the case of the Orm package) or a class named "Auth" (with the Auth package). And this is in part about performance because it would require a lot of extra filesystem checks to detect packages and load their bootstrap files. Which would be nonsense for a lot of users, and take all but 20 seconds for anyone who want to use a package to add it in config.
    with FuelPHP
    1. session will working when you config 'classes' => array('Session') but not work with session db.. until you load package 'packages' => array( 'orm')
    2. if you want to use another class or files you also need to do manual setting them.. also Language files..
    I'm sorry, there's no nice way to say this: all of this is nonsense.
    with Yii, Zend Framework, Symfony2 and my framework without MVC
    1. session are working and load automatic just setting db and session store.. file or DB?
    2. all file like language file or all class are loading automatic.. just use at all..
    Point 1 you can configure. I have no clue what you mean with point 2, but it sounds like another case of nonsense.
    What about Page rendered in????s using ???mb of memory. ?
    I was try to use my own framework without MVC and all class and all language file are auto loading and i got .. Page rendered in 0.003s - 0.03s
    Autoloader class make webapp slow? Not really.. I don't see any different from page load.. but ever easy to use because every class or language files are auto loader.. don't need to setting manual to loading class or files.. and Yii, Zend Framework, Symfony2 also working like this way in autoloader class and files.. page are not slow loading.
    If you want everything to be loaded in all the time: go look somewhere else. We don't do stupid stuff, neither does Yii, Zend or Symfony in this case. Fuel doesn't require you to load classes manually, everything is autoloadable. You do have to manually load lang/config files you add yourself, if a core class needs them they are loaded by the class. No clue what more any sane person would want.
    I just wanna know how to loading all class and all language files in simple way and easy way.. and well done .. because i don't like to do manual loading all class or language files each time... better that i can loading all class and all files .. just calling and use them .. easy way and don't worry if i am forget they name of file.. their already know by default..
    Classes ARE autoloadable. Any core lang/config files are loaded by the classes requireing them. You own stuff you have to either add to always_load in config or have it loaded by the class requireing it. Anything else, especially always loading everything is completely and utterly insane.
    You not care about memory loading?
    Autoloader class or files are not loading all file when you load page.. autoloader just let framework know where is a files or class.. and will load their class or files whenever you calling or using class or files.. then all the same concept with Fuel just load a class or files on demand but in different ways.. more easy and faster..
    As I've stated a thousand times by now: autoloading classes works without problems. Files you don't have to tell where they are, just put them in the right location and load them when you need them. Anything else is stupid. Look, I honestly think there's a language barier here. You just don't understand fully how Fuel works and you are making the wrong assumptions. Try to forget what you're assuming right now and try to grasp what I point out here and read the docs again, especially all the pages under "General".
  • Thank you to reply and make clearly n my head, Jelmer. you're right that I need to learn more to know how FuelPHP work as fuel way.. As i told you on IRC that found FuelPHP just a day before have discuss with you on IRC.. and for fast conversation on IRC may make me confuse.. And easy way for me if can't understand in conversation on IRC better to post me and make me clear as well.. I am really sorry about my misunderstanding in FuelPHP.. I must try to understand English more ( Thai is my base Language to conversation ) and learn more about FuelPHP... I may have some experience with another framework but I need to learn more about Fuel as well.. Anyway, really thank you again.. because FuelPHP seem more real community more than another Framework.
  • Well, first item on anyone's TODO list should be to learn English. If anyone's looking to do something even remotely connected to programming it should first learn English and the move forward. Almost all of the docs, tutorial, resources, etc are in English. Even the keywords of any programming language you would want to learn are in English.
  • daniels, I can understand English 85 - 95% for sure.. and always improved my English skill better to better anytime as i can. to learn of FuelPHP in English that not a problem for me.. because always learn of PHP and other Framework from English docs also.. for me just take sometime to learn of Fuel and find some more in Forum here.. that what can i do right now..

Howdy, Stranger!

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

In this Discussion