Building a Web API
#1

Alright so I am making this small framework that I will release further on once I complete it (its still in extremly early alpha, its being developed for like 2 days now lol).

It started off as a wordpress theme but I decided to do something else without it (therefore dont mind the github project name!)

Its still not safe to use, there are a bit of glitches and bugs I've found while working with it altho Im dedicated to it and I plan to release it once its fully done

This is the current progress
Click me

Why this?
Well it makes life easier, you could prety much build a secure register-login, UCP and the rest without too much knowledge of codding, makes life easier waaay more

This is for example how you could create login register system with it (It will feature ajax part also, just not done with PHP backend yet so dont expect it too soon). This is EARLY fiddle of it, it doesnt support any sort of form methods and so on, I do plan to introduce that in the future, so as Ajax.


Sample code (no ajax, no forms submitted etc, just the backend itself)
PHP Code:
//sample...
    
$QUERY_OBJECT = new safe_query();
    
$QUERY_OBJECT->prepare("SELECT"//type of the query we are making, SELECT, INSERT, UPDATE etc..
        
->what("Name, Password")
        ->
table("UsersTable")
        ->
where("Username='Twinki'"//by default, it will return ALL (*) results
    
->execute(); //executing the query
    //query will be SELECT Name, Password FROM UsersTable WHERE Username='Twinki'
    
    
if($QUERY_OBJECT->searchResult_bool("Name","Twinki") && $QUERY_OBJECT->searchResult_bool("Password","123")) { //if name exists and password is 123
        
echo "Welcome back Twinki!";
    } else {
        echo 
"You are not Twinki! Wrong password boi!";
    } 
Of course this will be simplified even more.

Whats the advantages of it?
- No need to worry about security as the backend will just do that for you
- Extremly easy to use even for people without PHP & MySQL knowledge

Disadvantages?
- It will take a bit of time to assemble it as Im the only one working on it and I want to keep it that way for this time being atleast


So what is your opinion on it?

I didnt place it under tools & others as its something in early development and its not for release just yet.
Reply
#2

My opinion is that it may be useful for people without this certain knowledge, it just isn't that beneficial in the long run however (e.g. a job, a different platform where SQL is required, etc.).

That shouldn't stop you from continuing it though.
Reply
#3

It looks okay, i'm a bit more fan of the way how Laravel does it, maybe you can get some ideas from it: https://laravel.com/docs/5.3/queries.

Little example how Laravel it does:
PHP Code:
DB:table('accounts')->get(); // Returns an object with all accounts.
DB:table('accounts')->where([
'username' => 'BlackBank'
'password' => 'test123'
])->first(); // Returns null if account doesn't match the where clause, else return the object of the logged in account. 
Reply
#4

@SickAttack yep agreed, as it depends on arrays heavily, going hard into it, making complicated queries and shit could turn out as something horrible lol but yep, my main priority is to make it as much as noob-friendly

@BlackBank3 well I have a bit of knowledge of Laravel myself, Ill look into it, maybe that could even turn out as a better solution.

Thanks for the headsup guys!
Reply
#5

Not bad, pal.

I would take a look at smaller frameworks for ideas, such as Nova, and Slim. I will link them below, I do like the way your going with this, could I ask what your target is at the end? Like what is the main goal your trying to achieve here?

If your attempting to create a framework for people to use, I probably wouldn't continue. Not to say you couldn't do it, more that its already been done many times, and the people who have done it, have a team working on it. Since it does take a lot of code, and knowledge of PHP, website vulnerabilities, and performance monitoring, in order to achieve a good framework. Not to mention that people will want an easy way to add to it, like a modular system.

However if your trying to create a full website, that people can download, install and do everything from a control panel, then please continue at will. Your code seems by far to be written by someone who has used PHP for a while now, and knows good coding practices, I appreciate people who actually take the time to follow such practices.

I wish you all the luck on this, would be nice to see the outcome once its at a stage, where it can be downloaded and used in full terms.

Some Useful Frameworks
Nova - Link
Slim - Link
Phalcon - Link
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)