Script47 Posted October 21, 2014 Share Posted October 21, 2014 I've been creating a lot of classes recently trying to make development quicker, easier and quicker. Personally I really liked this class I made so I thought I would share. Please feel free to add to it. Also read the read me for all the information. EasyPHP Class Quote Link to comment Share on other sites More sharing options...
Zettieee Posted October 22, 2014 Share Posted October 22, 2014 Nice! I'm looking to make a tribal wars style game, Might use this class :O thanks! Quote Link to comment Share on other sites More sharing options...
Dayo Posted October 22, 2014 Share Posted October 22, 2014 (edited) What is the licence to use this? Also another function that would be handy would be to change the content type of a file something like: /** * Changes the content type of the requested web page. * @param $contentType - The content type of the page. */ public static function contentType($contentType) { switch($contentType) { case "csv": $fileType = "text/csv"; break; case "xml": $fileType = "application/xml"; break; case "json": $fileType = "application/json"; break; case "stream": $fileType = "application/octet-stream"; break; } header("Content-type:".$fileType.";"); } The above is untested, you could also make a function to convert an array to a data type i.e. json, xml or csv. We have done this for our project at work for the API we are building Edited October 22, 2014 by Dayo Quote Link to comment Share on other sites More sharing options...
Script47 Posted October 22, 2014 Author Share Posted October 22, 2014 [MENTION=65371]sniko[/MENTION], thanks for all the messages on GIT, I'm looking in to them now. Nice! I'm looking to make a tribal wars style game, Might use this class :O thanks! No problem! I'm going to be updating it as much as I can so feel free to give me any feedback. What is the licence to use this? Also another function that would be handy would be to change the content type of a file something like: /** * Changes the content type of the requested web page. * @param $contentType - The content type of the page. */ public static function contentType($contentType) { switch($contentType) { case "csv": $fileType = "text/csv"; break; case "xml": $fileType = "application/xml"; break; case "json": $fileType = "application/json"; break; case "stream": $fileType = "application/octet-stream"; break; } header("Content-type:".$fileType.";"); } The above is untested, you could also make a function to convert an array to a data type i.e. json, xml or csv. We have done this for our project at work for the API we are building In terms of the license, do what you want with it but don't claim it as your own and don't remove the comment block at the start of the class. Thanks for the idea pal, will look in to it. Quote Link to comment Share on other sites More sharing options...
Dave Posted October 22, 2014 Share Posted October 22, 2014 Looks great! Would scrap the use of the <font /> tag, that's some legacy stuff! http://www.htmlgoodies.com/tutorials/html_401/html4-ref/article.php/3460291 Also the $_SERVER['HTTP_X_FORWARDED_FOR'] can be faked very easily and was an original issue in McCodes v2. and within your isEmpty function surely $variable is always set? public static function isEmpty($variable) { return !isset($variable) || empty($variable) ? FALSE : $variable; } Quote Link to comment Share on other sites More sharing options...
Script47 Posted October 22, 2014 Author Share Posted October 22, 2014 Looks great! Would scrap the use of the <font /> tag, that's some legacy stuff! http://www.htmlgoodies.com/tutorials/html_401/html4-ref/article.php/3460291 Also the $_SERVER['HTTP_X_FORWARDED_FOR'] can be faked very easily and was an original issue in McCodes v2. and within your isEmpty function surely $variable is always set? public static function isEmpty($variable) { return !isset($variable) || empty($variable) ? FALSE : $variable; } Haha, yeah the font stuff is just very easy. xD But mainly it was used to make point of how the function works and how you can display difference messages. I removed the HTTP_X_FORWARDED_FOR after a chat with [MENTION=65371]sniko[/MENTION] main class will be updated tonight. That function works fine, it is what I use for forms in HTML, so you can use this function to check if a form field is empty, and I've tested and it works fine. Also that function will be changed a little bit in the update tonight. Thanks for the feedback pal. Quote Link to comment Share on other sites More sharing options...
Script47 Posted October 22, 2014 Author Share Posted October 22, 2014 Version: 1.1.0 just updated. Quote Link to comment Share on other sites More sharing options...
Dayo Posted October 23, 2014 Share Posted October 23, 2014 In terms of the license, do what you want with it but don't claim it as your own and don't remove the comment block at the start of the class. So could i use this for commercial use where the customer will never see the code? (well i couldn't at them moment as there is no licence) Quote Link to comment Share on other sites More sharing options...
Script47 Posted October 23, 2014 Author Share Posted October 23, 2014 So could i use this for commercial use where the customer will never see the code? (well i couldn't at them moment as there is no licence) That's perfectly fine, I will add the license tonight. Quote Link to comment Share on other sites More sharing options...
Dayo Posted October 23, 2014 Share Posted October 23, 2014 Thanks, i only ask as i was thinking of using this for a large project at work and without a definitive licence i cant touch it. Quote Link to comment Share on other sites More sharing options...
Script47 Posted October 23, 2014 Author Share Posted October 23, 2014 Thanks, i only ask as i was thinking of using this for a large project at work and without a definitive licence i cant touch it. License Quote Link to comment Share on other sites More sharing options...
Script47 Posted October 25, 2014 Author Share Posted October 25, 2014 Version 1.1.4 License Updated Quote Link to comment Share on other sites More sharing options...
Script47 Posted January 14, 2015 Author Share Posted January 14, 2015 EasyPHP Framework So I've been working on this a bit more and these are the ideas/how it will work. This is currently available on GIT but as only one class with a bunch of functions which have just been garbled and put in to a file. Whereas now I have this sort of structure and several files which will be used to break down processes. So lets say you have a random project, a simple To-Do List. The file structure might be like this. To-Do List -css -js -php files? With EasyPHP it would be like this. The crucial difference would be that there is a EasyPHP folder with a structure like the following. To-Do List -EasyPHP -library -logs -errors.txt -Authentication.php -EasyPHP.php -ErrorHandler.php -Sanitize.php -Session.php I plan on making classes for both PDO and MySQLi, we'll see how that goes. I have already made the PDO one with chainable queries, but might change a few bits and bobs on that. Inside library folder will be your application specific PHP classes, they will be autoloaded. That is the current idea. Tomorrow I would go in to more details about the classes hopefully. Any classes or ideas you'd like to see, just post below. I'll see if they can be added. Quote Link to comment Share on other sites More sharing options...
Sim Posted January 15, 2015 Share Posted January 15, 2015 EasyPHP Framework I plan on making classes for both PDO and MySQLi, we'll see how that goes. I have already made the PDO one with chainable queries, but might change a few bits and bobs on that. Inside library folder will be your application specific PHP classes, they will be autoloaded. That is the current idea. Tomorrow I would go in to more details about the classes hopefully. Any classes or ideas you'd like to see, just post below. I'll see if they can be added. They would be called singelton classes.. But, something I usually overlook is a File/Image class. I actually included one of these in my latest project I am working on. Quote Link to comment 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.