-
Notifications
You must be signed in to change notification settings - Fork 2k
[6.0] Roadmap #587
Comments
Wow, there are a lot of good changes here!
I'm confused only about this point, outside the EOLs and the dependencies' required PHP version what is the reason? Are there any PHP 5.6+ features those could improve the codebase? If yes than it's great, otherwise I'm a bit against this. My only suggestion is to include a log system (possibly based on PSR-3) for the requests and the API requests debugging. |
since this is a major version change, i'm all for switching to a v5.6 requirement. what's the thought behind removing multiple exceptions and switching to just one? while there could be one parent thanks! |
I'll think of other ideas when I have time :) |
EOL means that version of PHP no longer gets updated - for both bug fixes or security issues. So the reason for the upgrade is to ensure the SDK can't be exploited on an old known security hole in an old version of PHP. Plus 5.6 has some TLS improvements that will be helpful for the SDK. :)
The idea would be we could have just two:
This is the same as v5 but in v5 try {
$me = $fb->get('/me');
} catch(FacebookResponseException $e) {
if ($e->getPrevious() instanceof FacebookAuthenticationException) {
if ($e->getCode() == 10 || ($e->getCode() >= 200 && $e->getCode() <= 299)) {
// Missing permissions
} else {
// General authentication failure
}
} elseif ($e->getPrevious() instanceof FacebookResumableUploadException) {
//
} elseif ($e->getPrevious() instanceof FacebookThrottleException) {
//
} elseif ($e->getPrevious() instanceof FacebookClientException) {
//
}
} Whereas the API to find the specific error could be made more clear: try {
$me = $fb->get('/me');
} catch(FacebookResponseException $e) {
switch ($e->getType()) {
case FacebookResponseException::AUTHENTICATION_FAILURE;
//
break;
case FacebookResponseException::MISSING_PERMISSIONS;
//
break;
case FacebookResponseException::RESUMABLE_UPLOAD_FAILURE;
//
break;
case FacebookResponseException::THROTTLE_LIMIT_REACHED;
//
break;
case FacebookResponseException::DUPLICATE_POST;
//
break;
}
} So you get even more specificity with a cleaner API. :) |
|
try {
$me = $fb->get('/me');
} catch(FacebookAuthenticationFailureException $e) {
//
} catch(FacebookMissingPermissionsException $e) {
//
} catch(FacebookAuthenticationException $e) {
// generic authentication exception
} catch(FacebookResumableUploadException $e) {
//
} catch(FacebookThrottleException $e) {
//
} catch(FacebookClientException $e) {
//
} catch(FacebookResponseException $e) {
// generic exception
} Clearer isn't it? :) |
Yeah, that's certainly better. I'm just not a fan of throwing a separate exception for every possible error response. But that's just a preference thing so I'll go with whatever the majority want. :) |
@SammyK with this, the user can choose exactly which exception he/she want to catch. Imagine you want to catch only the missing permission error, with your code you'll need to first catch, and then check for the type. :) |
Makes sense. :) |
When we start :) ? |
@tolbon Haha! Good question. :) I guess the first step is set up the repo for a merging strategy. @yguedidi If I remember correctly from the last major upgrade. We make |
@SammyK I create two new branches:
Any bugfix must go in the lowest affected branch, then we will have to merge the fixed branch with it's newer one. What do you thing about this? |
|
Composer is the de facto package dependency manager for PHP, so we will only support this installation method. If you don't want to use composer, you will always be able to download the zip file and write your own autoloader :) |
Why? Autoloader is already there. Why not give the user the option, like it is now? Isn't the point of the SDK's to have the needed code written for the Dev's so they don't have to write it!? |
Hey @Kastlebrick! The latest version of the SDK will be pulling in dependencies with composer so even if you write your own autoloader, it would need to include those dependancies. Is there a specific reason why you're against using composer? :) |
It isn't! Even a framework will not write your business logic for you :) BTW, I'm curious about the reason why you don't like composer.. |
@SammyK Never used it, don't have it, and it's one less thing I would have to install and maintain on my server. @yguedidi I think the point I am trying to make is that the SDK should be self contained. And I/we shouldn't have to rely on some other 3rd party code just to make it work. Yes I 'write the business logic', but (in a nutshell) the Autoloader simply loads what is needed for the SDK so I can make that connection to FB. I really don't want to argue semantics, but what you call 'good practice' I call bad. If you feel it's good to offer the option to use composer, then at least to both.. and don't require it. I guess, in the end, you will do what you want.. and this is just my two cents, but I don't understand why you would require and rely on some other 3rd party just to make your code work (when it's not necessary). |
Have you guys thought about distributing sdk in a phar? It will be self-contained, no autoloader needed. |
@SammyK it could be nice to update the description of that issue where each point would mention their corresponding PR (when there is one!) :) |
Thoughts? :)
get()
to accept array of params since it's the most requested featuredefault_graph_version
required and remove the fallback constantFacebook
prefix from nearly all classesfacebook-php-sdk-v4
tofacebook-php-sdk
and add 301; abandonfacebook/php-sdk-v4
on Packagist and create new alias:facebook/sdk
GraphNode
's andGraphEdge
's and just return a Guzzle response stream?Context
orEnvironment
namespace?The text was updated successfully, but these errors were encountered: