Foundation
Foundation is a simple micro framework built in PHP OOP using Symfony components (httpKernel, httpFoundation, Routing), Laravel components (Blade templating) and others with PHP version >= 5.3 fully supported, including HHVM.
Foundation follows the MVC architecture and also make use of templates for a more clean and understandable View code, this will make life easier for people who wish to change the HTML template and redesign it by providing a total separation between front end (design) and back end (logic, functionality).
Why?
Simply because my Maple project will make use of several web apps and services including APIs, by working on this project I eliminate the need to redo the base (core, routing, http handling, error handling, logging, MVC, PDO & ORM, installation, etc) each time I need to work on a new web app/service, also this will help greatly to the MS pserver community simply because it will have public and very modular (easy to extend as well) CMS and it will be released eventually.
I ended up discarding everything I've done the past week or so for a new base, started this yesterday didn't work much, also it's quite a mess atm but it werks appropriately. Still need to clean it and make a Core class to handle most of it, implement Monolog logging, error handling, models, database interactions, translations, etc.
Contributors Hopefully the list will grow
@kingslime
Libraries Composer - Packages management Symfony - Most Components Laravel - Blade Templating The PHP League - Container package Monolog - Logging package
31-12-15
Snopboy
Re: [ALPHA] Sporter Framework v2
Sporter v2 is now available on GitHub!
Sporter v1.5.1 has been moved to repository "SporterOLD".
Sporter v2 will be fully written in OOP, following a better structure design that will make our lives easier when developing it, no more using "global" to increase variables and objects scope, the new design will solve the scope issues.
Another thing to note, Sporter v2 will be much easier to extend and work with than Sporter v1 was.
Current Development Build: Alpha 2.0
Current Stable Build: Not Available
Sporter v2 is released with the MIT license so please do fork it and contribute :)
##### ORDER ##### index.php -> Application\bootstrap.php
01-01-16
oxysoft
Re: [ALPHA] Sporter Framework v2
tbh you're wasting your time
01-01-16
AristoCat
Re: [ALPHA] Sporter Framework v2
too bad ms is dead and nobody is going to use it (except for maybe you)
01-01-16
Snopboy
Re: [ALPHA] Sporter Framework v2
Quote:
Originally Posted by oxysoft
tbh you're wasting your time
I don't think that learning is a waste of time..
Quote:
Originally Posted by AristoCat
too bad ms is dead and nobody is going to use it (except for maybe you)
I'm afraid you're right lol
01-01-16
iAkira
Re: [ALPHA] Sporter Framework v2
Location: Sporter/application/bootstrap/core/router.class.php Summary: In your handle_route function, you are repeating some codes in other if statements, just move it outside. Repetitive. Question: the get_routes function has an argument $config and "$this->handle_route($match);" is calling $match, but the $match variable doesn't exist in that function nor class anywhere? Changes:
include CONTROLLERPATH.$controller_class.CONTROLLERFIX.EXT;
Add:
PHP Code:
if($error) { $controller_class = self::$errorMSG[0]; $controller_name = self::$errorMSG[1]; $action = self::$errorMSG[2]; //Add $error=false; if the $error variable doesn't reset or an error comes up }
Also remove a bunch of functions in your classes that are empty, no use for them. Besides that I can't help you anymore, the project is literally like 2-3 frameworks(if you include the DB framework), I'm not optimizing a framework. Literally 95% of the github is framework relations and framework classes. Hope this helps though.
02-01-16
Snopboy
Re: [ALPHA] Sporter Framework v2
Quote:
Originally Posted by iAkira
Location: Sporter/application/bootstrap/core/router.class.php Summary: In your handle_route function, you are repeating some codes in other if statements, just move it outside. Repetitive. Question: the get_routes function has an argument $config and "$this->handle_route($match);" is calling $match, but the $match variable doesn't exist in that function nor class anywhere? Changes:
include CONTROLLERPATH.$controller_class.CONTROLLERFIX.EXT;
Add:
PHP Code:
if($error) { $controller_class = self::$errorMSG[0]; $controller_name = self::$errorMSG[1]; $action = self::$errorMSG[2]; //Add $error=false; if the $error variable doesn't reset or an error comes up }
Also remove a bunch of functions in your classes that are empty, no use for them. Besides that I can't help you anymore, the project is literally like 2-3 frameworks(if you include the DB framework), I'm not optimizing a framework. Literally 95% of the github is framework relations and framework classes. Hope this helps though.
Yeah, I decided to use external libraries for components that my current level is insufficient to write on my own, although I could've tried but then again as Greenelf said, it would be reinventing the wheel..
Regarding the question you asked about the variable.
Since the constructor calls get_routes function, and the get_routes function directly includes the router.php from configuration dir which does have the $match variable, then calls $this->handle_route($match); from get_routes with the variable that was set inside the included file one line before it, within the scope of the function, I think this variable does exists and it works, otherwise I'd see an error because the ENVIRONMENT is set to development and there's no php error/exception handling at the moment.
I can't seem to find the empty functions you were talking about unless you meant for the functions in *_controller.php which are supposed to be empty at the moment, these are the "actions" of the controller, each function will set it's own view, models and logic for it's page, i.e. class News function index is route /news
News->test is route /news/test, etc..
I have fixed the repetitive code, thank you very much for that! I really appreciate it :)
08-01-16
greenelfx
Re: [ALPHA] Sporter Framework v2
I don't understand this project anymore. If you've switched to MVC & OOP, and you are using released components on Github, what exactly are you doing other than building some additional configuration and views? How is this any different from a framework like Slim? Why not just use Slim? What you are doing is now trivial, because you are no longer against using tried and true libraries. Also, if you insist on building your own "micro framework" you should be using Symfony components, because those are considered to be the standard.
08-01-16
Snopboy
Re: [ALPHA] Sporter Framework v2
Quote:
Originally Posted by greenelfx
I don't understand this project anymore. If you've switched to MVC & OOP, and you are using released components on Github, what exactly are you doing other than building some additional configuration and views? How is this any different from a framework like Slim? Why not just use Slim? What you are doing is now trivial, because you are no longer against using tried and true libraries. Also, if you insist on building your own "micro framework" you should be using Symfony components, because those are considered to be the standard.
I am not using public libraries for each and every thing there, I used it for the complex stuff that I can't possibly do on my own in a good way, and actually because of you, you told me to not reinvent the wheel so I use existing components to not rewrite my own, which will be worse than the ones I'm using.
By doing this project, I get the chance to go underneath the surface and see how everything works, learn more than what I could learn by using a different framework.
Using Symfony components? No, why? Because all the other frameworks use it. I want to have something different here.
Although using these third party components shortens the development time and make everything easier for me, it still doesn't do everything for me, I still need to write countless of libraries myself, lots of features and assemble everything together in a good way that will allow people to maintain it and extend it easily, so no - I'm not "building some additional configuration and views".
Let me guess, you thought I'll be using all the procedural code that is available in the MapleStory community for all the features or perhaps ripp your MapleBit/Cype's functions? No, if I were to do so then there would be no "work" to do here at all, everything else regarding the framework would be irrelevant in that case. I'll be writing every function from scratch in OOP.
10-01-16
Snopboy
Re: [ALPHA] Sporter Framework v2
New class have been added, called Sporter.
This class will be responsible for providing external functionalities to the Controllers and Views.
All the necessary tools for building your application safely and efficiently will be in that class.
Sporter Alpha v2.0.0.1 is already faster, more efficient and even smaller in size than Alpha v1.5 by more than three (3) times(!), this of course excludes the git and static folders that may add some weight there by up to 1mb.
Even if I don't post updates/push new commits, it doesn't mean I stopped working on it. I continue to work on this fascinating project and hopefully the end product will be amazing and useful for many Maplers ;)
11-01-16
AristoCat
Re: [ALPHA] Sporter Framework v2
Quote:
Originally Posted by Snopboy
I am not using public libraries for each and every thing there, I used it for the complex stuff that I can't possibly do on my own in a good way, and actually because of you, you told me to not reinvent the wheel so I use existing components to not rewrite my own, which will be worse than the ones I'm using.
By doing this project, I get the chance to go underneath the surface and see how everything works, learn more than what I could learn by using a different framework.
Using Symfony components? No, why? Because all the other frameworks use it. I want to have something different here.
Although using these third party components shortens the development time and make everything easier for me, it still doesn't do everything for me, I still need to write countless of libraries myself, lots of features and assemble everything together in a good way that will allow people to maintain it and extend it easily, so no - I'm not "building some additional configuration and views".
Let me guess, you thought I'll be using all the procedural code that is available in the MapleStory community for all the features or perhaps ripp your MapleBit/Cype's functions? No, if I were to do so then there would be no "work" to do here at all, everything else regarding the framework would be irrelevant in that case. I'll be writing every function from scratch in OOP.
"different"
just because its different doesnt mean people will use it neither does it make it better
14-01-16
Snopboy
Re: [ALPHA] Sporter Framework v2
Quote:
Originally Posted by AristoCat
"different"
just because its different doesnt mean people will use it neither does it make it better
Have you even bothered to read the previous comments or the first post? I think not.
I never said it will be better than the other Frameworks, I'm still a newbie and even the best programmer in RaGEZONE can't make a framework that could compete with the popular frameworks, these are made by people who regularly work on enterprise applications, in case you forgot I'm just a beginner.
Why would anyone use this? I already explained why, this will be more suited for MapleStory and also will give you a complete solution, you wont even need to deal with tech stuff like programming, it will have everything you want. Also changing templates will be so easy that a 12years old could do it without previous knowledge/experience in coding of any sort.
I also plan to make extensions and plugins library for this, to allow people to install new features easily without the need to manually edit files (much like vBulletin has, same can be done for templating), taking MapleStory websites 10 steps ahead. But that's too early to even talk about this.
- - - Updated - - -
Rolled a small update
New view container has been added, still need to isolate it and make some checks (not empty, whether key/value exists, etc).
Loading views is now available as follows
PHP Code:
$this->load()->view([ 'name' => 'file_name', 'ext' => 'extension', 'path' => 'path_from_views' ], $data); // REQUIRED 'name' - that is the name of the file you want to load, if file doesn't exist it will load welcome.php // optional 'ext' - file extension, default {ENV}EXT=php, // optional 'path' - inner path to file from views directory, i.e. 'errors/' will look the file at 'application/views/errors/', default {ENV}VIEWPATH=application/views/
Another small update
I just wrote very basic templating function, perhaps I'll even make a full templating engine from it (if else, foreach statements, etc).
wherever you want the view file to be loaded and it will.
21-01-16
Snopboy
Re: [ALPHA] Sporter Framework v2
New release, Alpha 2.0.0.2 is now available as the most stable build.
Stable Build: 2.0.0.2 release
GitHub: Sporter Repository
Build Size: 39.6kb
28-01-16
Snopboy
Re: [ALPHA] Sporter Framework v2
Pushed a small update for the routes and error handlers, some small optimizations (mainly changed array_key_exists() to isset() because it's faster).
If and of your controllers throws an exception, when accessing it, it will display the router's default 0x00 operation code error, I will change this later to a more specific operation method like
Currently working on yet another rewrite, I'm pretty sure this one is somewhat final as I already got some understanding of OOP.
The new version will follow the PSR standards (hopefully, this depends on how much information I could absorb about this in such a short time), Singleton and will have an autoloading (either Composer, SPL or self made).
Loading views and templates (and also PHP plugins) will be stored and retrieved from Database and written to the disk as a cache. Still reading about this and it's really interesting (The way WordPress and vBulletin does it).
07-02-16
greenelfx
Re: [ALPHA] Sporter Framework v2
Quote:
Originally Posted by kingslime
Currently working on yet another rewrite, I'm pretty sure this one is somewhat final as I already got some understanding of OOP.
The new version will follow the PSR standards (hopefully, this depends on how much information I could absorb about this in such a short time), Singleton and will have an autoloading (either Composer, SPL or self made).
Loading views and templates (and also PHP plugins) will be stored and retrieved from Database and written to the disk as a cache. Still reading about this and it's really interesting (The way WordPress and vBulletin does it).
Use composer. Do not make your own...please.
07-02-16
Snopboy
Re: [ALPHA] Sporter Framework v2
Quote:
Originally Posted by greenelfx
Use composer. Do not make your own...please.
I've yet to look much into Composer, once I do I'll determine whether I use it or use the alternatives.
This will most likely depend on ease-of-use for complete beginners, convenience and flexibility.
I'm looking into working with namespaces and interfaces too, this may be a plus.
Also I'm currently thinking whether to take this development down and develop it privately or leave as is (open source). I've yet to receive any feedback on my code, ultimately this makes the quality of the code pretty bad because no one points out what I'm doing wrong so I can't really improve, which is a shame.
10-02-16
Snopboy
Re: [ALPHA] Sporter Framework v2
@greenelfx
I don't see how composer could contribute to this project, it will just make things more complicated for beginners.
I finally understand a bit about namespaces, at first I thought it does something else but now I understand it.
Here's a very minimal prototype, been spending most of the time on organizing it, thinking of the concept and planning how I'll put it down in code. https://github.com/snopboy/Prototype
06-03-16
Snopboy
Re: [ALPHA] Sporter Framework v2
Working on Kernel, the current Kernel will probably be discarded soon and written from scratch again.
Started writing a small Registry with a few methods to manage your objects (store, storeSingleton, get, drop, clear).
Small autoloader, needs some work to be done, it's still messy and minimal.
A loader class to load whatever you need into your controller, there's base controller, example of model available in index.php, very elegant and beautiful, one of the main goals is ease of development and basically make it joyful.
Will be ripping Laravel's Blade template engine, I fucking love it.
Will implement cache storage, view compiler (because we don't want the engine to parse all the templates all the time), database abstraction with fail safe, maybe even support connections to multiple databases simultaneously.
So far the design seems to be good, but still needs some adjustments to be fully compliant with PSR standards.
Composer might be implemented as an optional tool to handle packages but so far it is not necessary.
I've learned a lot about programming from working on this project.
If anyone wants to contribute, feel free to leave a message and we could work together.
OP is being edited now.
20-05-16
Snopboy
Re: [ALPHA] Sporter Framework v2
Quote:
Originally Posted by greenelfx
Use composer. Do not make your own...please.
You asked for it? You got it.
Composer + Symfony + Laravel xD
A continuation, this time I need it for a Maple server project I'm working on so I'll dedicate more time to it than the previous web development.
24-05-16
Snopboy
Re: [DEV] MapleStory Web Framework
Discarded previous base, started new one yesterday, it's now open source and available on GitHub.
Any feedback is greatly appreciated! https://github.com/snopboy/Foundation
24-05-16
greenelfx
Re: [DEV] MapleStory Web Framework
Quote:
Originally Posted by kingslime
Discarded previous base, started new one yesterday, it's now open source and available on GitHub.
Any feedback is greatly appreciated! https://github.com/snopboy/Foundation
So now that you're using industry standard components, what's the motivation behind this project? You'll find that frameworks like Silex or Lumen are basically what you're going for, if not more. Why not just build off of those?
24-05-16
Snopboy
Re: [DEV] MapleStory Web Framework
Quote:
Originally Posted by greenelfx
So now that you're using industry standard components, what's the motivation behind this project? You'll find that frameworks like Silex or Lumen are basically what you're going for, if not more. Why not just build off of those?
I find every established framework to be overloaded with crap, also I prefer knowing the core that I'm going to work with instead of just dealing with the application related stuff, it's an opportunity for me to learn more.
The reason for doing this project is to both provide the community with a CMS that provides separation of concerns, best practices and most of all - flexibility.
I find it very difficult to replace templates on MapleBit for example, because the HTML and PHP are literally mixed together which makes me break stuff countless times and then fix it.
Another thing is that when the core is simple and small, changes can be made with ease should it ever be required.
I both like learning about PHP and programming as a whole and of course I need a reliable Framework for my pserver project so I could build CMSs for both the Test server and official server along with all necessary APIs and control panels.
You could help with code reviews or push new code if you ever wish to contribute, I'm hoping to push the pserver community forward in the right path of OOP and good standards, anyone who wishes to contribute is invited to do so :)
-Changes will be done to application.php, this code will most likely will be separated in a few methods inside a class instead of being in raw php structure.
-Need to implement Monolog and error handling later as well.