wordnik / wordnik-php Goto Github PK
View Code? Open in Web Editor NEWWordnik PHP public library
Wordnik PHP public library
The examples of the words contains unknown characters due to which I am not able to use json_decode over it. Please remove those characters as I have even tried many patterns in preg_replace. Still no success.
The json_last_error is returning "4" as error while using json_decode.
Hi! I've been trying to get an API key for the last few days. I keep seeing that it is supposed to be at the bottom of the settings page but it shows . Here is a picture of what my account looks like. Your API key is: Your API key is not yet available. Check back in a few days. Please help!
I've been trying to get API key for past 2 days but I couldn't. I've created account of wordnik.com and also signedup for apikey at developer.wordsapi.com but yet nothing. PLS help ASAP
When you try to specifiy the order of sources to look through in the parameters for getDefinitions(), it fails and returns nothing.
Words with spaces won't return anything.
Throwing an exception using the generic "Exception" class is not best practice. It's counter intuitive in the following way:
When implementing the API, we have to wrap this in a try/catch block like so:
// Attempt Wordnik API authentication.
try {
$authResponse = $this->wordnik->authenticate($username, $token->getPassword());
} catch(\Exception $errorResponse) {
$errorMessage = $errorResponse->getMessage();
// ...
}
However by catching "Exception", we may end up catching Exceptions we didn't intend to catch, preventing other Exceptions from coming to light, and causing new problems in our catch clause.
For example: What if $token->getPassword()
produces an exception? This will also be caught by my try/catch block, however my catch
block was written to anticipate the specific use of the Exception class coming from ApiAccount#authenticate
, and now an Exception might occur in my catch
block. I just experienced this exact issue.
The solution to this problem is to create custom, Swagger-specific Exception classes, i.e. in this case SwaggerApiAuthenticationException
. Then my try/catch block could target this specific Exception, and I wouldn't, as they say, catch 'em all.
I know that the API is Swagger-generated so I won't fork the repository or submit a patch. However it would be ideal if Swagger was able to generate PHP API wrappers which defined and implemented custom exceptions.
EDIT:
This problem also effects timeout issues. When there's a timeout on the request, an Exception gets thrown, but aside from inspecting the Exception's error message, I have no way of knowing that the user didn't supply an incorrect password. This is because the Exceptions all have the same class, and none of them have error codes, so there's no real way to distinguish what the problem was.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.