nathggns / Scaffold

Lightweight PHP API Framework
Other
8 stars 2 forks source link

Modular Scaffold #105

Open nathggns opened 11 years ago

nathggns commented 11 years ago

In order to retain the "lightweight" description, we need to make some modifications. It's actually pretty hefty at the moment.

One thing that would certainly become a module is the database side, which includes the following classes.

Every driver and builder would be its own module, apart from SQL,SQLite and PDO.

However, there are some other classes that could become parts of a module too, namely:

There are some others that aren't necessarily core classes, but could be needed by the core:

nathggns commented 11 years ago

This issue could be of use to modules?

90 Namespacing

nathggns commented 11 years ago

Every module would need it's own bootstrap.php, config/* and functions.php. Maybe services.php and routes.php even...

nathggns commented 11 years ago

Speaking of that, we should split system/bootstrap.php into bootstrap.php and services.php. Create the ability for routes.php to exist too.

ClaudioAlbertin commented 11 years ago

Dummy and Dynamic should be removed, the rest should be part of the core. I think the router should be a module too. Actually, everything should be a module that isn't part of the system around the modules, such as services, the autoloader and configuration system.

nathggns commented 11 years ago

However, which modules should be separate, and which should be bundled with the core framework?

The issue with removing Dynamic is that assigning functions as property's are difficult without it.

Dummy should definitely be removed. How did that even make it in?!

I'd love to remove Shutdown and Dynamic, but it's difficult, as there are a lot of bugs in PHP that are so annoying.

nathggns commented 11 years ago

How should the new structure of Scaffold look?

I'm thinking something like this

Core

Bundled Modules

Web

Validator

Separate Modules

Database (Already established what would be in this one)

ClaudioAlbertin commented 11 years ago

Response would also be in the Web module

ClaudioAlbertin commented 11 years ago

What does Shutdown do? Remove dynamic though. Rather use a temporary variable to call the function, or call_user_func().

nathggns commented 11 years ago

It's like a gateway between PHPs shutdown function system and Error. Allows you to unset a shutdown function, basically.

ClaudioAlbertin commented 11 years ago

Why is that needed? Don't set it if you don't want to set it. You can use exit() within the shutdown function to prevent other shutdown functions to be executed.

nathggns commented 11 years ago

I actually don't remember why I added it, I believe it solved a bug though...

nathggns commented 11 years ago

Problem: Error relies on Response

ClaudioAlbertin commented 11 years ago

Error should use a Logger class, which can be assigned loggers for CLI, JSON, HTML etc.

ClaudioAlbertin commented 11 years ago

Modules should have their own namespace each.

nathggns commented 11 years ago

But then those Loggers will eventually need a Response class of some kind. :S

ClaudioAlbertin commented 11 years ago

Yes, the Web module will implement a Web logger.

nathggns commented 11 years ago

And what will the default loggers log to, a file? STDOUT?

ClaudioAlbertin commented 11 years ago

there should be loggers for both included with the core, yes.

nathggns commented 11 years ago

Which would be the default?

ClaudioAlbertin commented 11 years ago

In production it should log to a file, in development it should log to STDOUT by default. But that should be set by the configuration.

nathggns commented 11 years ago

Okay cool.

The Web Module will of course be included by default right?

ClaudioAlbertin commented 11 years ago

Yes.

ClaudioAlbertin commented 11 years ago

But it shouldn't be part of the core module, obviously.

nathggns commented 11 years ago

We can do this with Composer support, which should be easy to add with #140.