deathbeam Posted September 10, 2014 Share Posted September 10, 2014 So I am working on my own PHP framework and I am using this: php_value auto_prepend_file library/fw.php php_value auto_append_file library/fw.php To auto prepend and append file. In that file I have check if instance of core class located in fw.php is defined so it will not prepend and append duplicates. With this I reduced index.php code by these 2 lines // This should be at beggining of index php $fw = Base::getInstance(); // This should be at very end of index.php $fw->run(); Is it good or bad way? Quote Link to comment https://forums.phpfreaks.com/topic/290966-using-htaccess-for-auto_including-files-in-framework/ Share on other sites More sharing options...
Ch0cu3r Posted September 10, 2014 Share Posted September 10, 2014 Most modern framework use autoloaders to including classes Also see http://php.net/manual/en/function.spl-autoload-register.php http://www.php-fig.org/ Quote Link to comment https://forums.phpfreaks.com/topic/290966-using-htaccess-for-auto_including-files-in-framework/#findComment-1490614 Share on other sites More sharing options...
Solution mac_gyver Posted September 10, 2014 Solution Share Posted September 10, 2014 also, putting php settings into a .htaccess file only works when php is running as an apache module, which is uncommon on shared web hosting. so doing it the way you are trying would limit your framework to just apache servers and to just a fraction of those that have php running as a server module. Quote Link to comment https://forums.phpfreaks.com/topic/290966-using-htaccess-for-auto_including-files-in-framework/#findComment-1490644 Share on other sites More sharing options...
deathbeam Posted September 11, 2014 Author Share Posted September 11, 2014 Most modern framework use autoloaders to including classes Also see http://php.net/manual/en/function.spl-autoload-register.php http://www.php-fig.org/ I was not asking about using autoloader, that will defeat purpose of simplifying my code, why should I use autoloader when my framework is only single php file? also, putting php settings into a .htaccess file only works when php is running as an apache module, which is uncommon on shared web hosting. so doing it the way you are trying would limit your framework to just apache servers and to just a fraction of those that have php running as a server module. Oh, thank you very much for this info. I am focusing on ability to use my fw on shared hosting, so then I will scrap this idea. Quote Link to comment https://forums.phpfreaks.com/topic/290966-using-htaccess-for-auto_including-files-in-framework/#findComment-1490777 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.