{"id":15296307,"url":"https://github.com/darrynten/watson-personality-insights-php","last_synced_at":"2025-04-13T19:53:28.444Z","repository":{"id":56962557,"uuid":"81797058","full_name":"darrynten/watson-personality-insights-php","owner":"darrynten","description":"Framework Agnostic Watson Personality Insights Client","archived":false,"fork":false,"pushed_at":"2017-03-17T19:24:51.000Z","size":37,"stargazers_count":14,"open_issues_count":1,"forks_count":4,"subscribers_count":3,"default_branch":"dev","last_synced_at":"2025-03-27T10:38:48.538Z","etag":null,"topics":["ai","artificial-intelligence","client","coverage","framework-agnostic","ibm","ibm-watson-services","machine-learning","php","php-library","php7","unit-tested","watson"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/darrynten.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-13T07:28:25.000Z","updated_at":"2022-10-15T06:58:03.000Z","dependencies_parsed_at":"2022-08-21T05:40:21.140Z","dependency_job_id":null,"html_url":"https://github.com/darrynten/watson-personality-insights-php","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darrynten%2Fwatson-personality-insights-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darrynten%2Fwatson-personality-insights-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darrynten%2Fwatson-personality-insights-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darrynten%2Fwatson-personality-insights-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/darrynten","download_url":"https://codeload.github.com/darrynten/watson-personality-insights-php/tar.gz/refs/heads/dev","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248774218,"owners_count":21159527,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","artificial-intelligence","client","coverage","framework-agnostic","ibm","ibm-watson-services","machine-learning","php","php-library","php7","unit-tested","watson"],"created_at":"2024-09-30T18:10:01.267Z","updated_at":"2025-04-13T19:53:28.421Z","avatar_url":"https://github.com/darrynten.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"## watson-personality-insights-php\n\n![Travis Build Status](https://travis-ci.org/darrynten/watson-personality-insights-php.svg?branch=master)\n![StyleCI Status](https://styleci.io/repos/81687310/shield?branch=master)\n[![codecov](https://codecov.io/gh/darrynten/watson-personality-insights-php/branch/master/graph/badge.svg)](https://codecov.io/gh/darrynten/watson-personality-insights-php)\n![Packagist Version](https://img.shields.io/packagist/v/darrynten/watson-personality-insights-php.svg)\n![MIT License](https://img.shields.io/github/license/darrynten/watson-personality-insights-php.svg)\n\nA framework agnostic fully unit tested client for IBM Watson Personality\ninsights API.\n\nFor PHP 7.0+\n\n### Install\n\n```bash\ncomposer require darrynten/watson-personality-insights-php\n```\n\n### Usage\n\n```php\n// Required config\n$config = [\n    'username' =\u003e $username,\n    'password' =\u003e $password\n];\n\n// Get an instance\n$instance = new PersonalityInsights($config);\n\n// Add some text\n$text = file_get_contents('sample.txt');\n$instance-\u003eaddText($text);\n\n// Get the insights\n$insights = $instance-\u003egetInsights();\n```\n\nSome things you can set\n\n```php\n// Set standard options\n$instance-\u003econfig-\u003esetConsumptionPreferences(true);\n$instance-\u003econfig-\u003esetRawScores(true);\n$instance-\u003econfig-\u003esetVersion('2017-01-01');\n$instance-\u003econfig-\u003esetContentTypeHeader('application/json');\n$instance-\u003econfig-\u003esetContentLanguageHeader('en');\n$instance-\u003econfig-\u003esetAcceptHeader('application/json');\n$instance-\u003econfig-\u003esetAcceptLanguageHeader('en');\n$instance-\u003econfig-\u003esetCsvHeaders(false);\n// https://watson-api-explorer.mybluemix.net/apis/personality-insights-v3#!/personality45insights/profile\n\n// Set caching of requests\n$instance-\u003econfig-\u003esetCaching(false);\n\n// Opt in to Watson tracking (off by default)\n$instance-\u003econfig-\u003esetOptOut(false);\n\n// All config options\n$config = [\n    'username' =\u003e $username,\n    'password' =\u003e $password,\n    'version' =\u003e $version,\n    'raw_scores' =\u003e $boolean,\n    'consumption_preferences' =\u003e $boolean,\n    'cache' =\u003e $boolean,\n];\n\n```\n\nYou can also add a `ContentItem` directly\n\n```php\n/**\n * All possible content item config options. Only the `text` one is\n * required.\n *\n * https://watson-api-explorer.mybluemix.net/apis/personality-insights-v3#!/personality45insights/profile\n *\n * Defaults\n *\n * id - An md5 of the text\n * created - 0\n * updated - 0\n * contenttype - 'text/plain'\n * language - en\n * parentid - null\n * reply - false\n * forward - false\n */\n$contentConfig = [\n    'text' =\u003e $text,          // The only required value\n    'id' =\u003e $string,          // Is the md5 of the text if not set\n    'created' =\u003e $timestamp,  // Is 0 if not set\n    'updated' =\u003e $timestamp,  // Is 0 if not set\n    'contenttype' =\u003e $string, // `text/plain` or `text/html`\n    'language' =\u003e $string,    // `en` or similar\n    'parentid' =\u003e $string,    // The ID of a parent item. Null if not set\n    'reply' =\u003e $boolean,      // Indicates if it is a reply to another\n    'forward' =\u003e $boolean,    // Indicates if it is a forwarded text\n];\n\n$contentItem = new ContentItem($contentConfig);\n$contentItem-\u003egetContentItemJson();\n\n$instance-\u003eaddNewContentItem($contentItem);\n```\n\n## Notes\n\n### Privacy\n\nIBM have a mode that keeps a copy of your data on their side for the\napparent training of Watson. This is normally opt-out.\n\nAs this isn't explicitly made clear, we have decided to **disable by\ndefault** so if you do with to help Watson learn then you can do\nso by opting-in as outlined in the examples above.\n\nBy default this package will not allow any tracking of any kind.\n\n### \"Version\"\n\nThis is the source of some confusion. This is a date in the format of\n'YYYY-MM-DD' and Watson will use whichever version was around at that\ntime.\n\nFull quote\n\n\u003e The requested version of the response format as a date in the form\nYYYY-MM-DD; for example, specify 2016-10-20 for October 20, 2016. The\ndate that you specify does not need to match a version of the service\nexactly; the service replies with the response format whose version is\nno later than the date you provide. If you specify a date that is earlier\nthan the initial release of version 3, the service returns the response\nformat for that first version. If you specify a date that is in the future\nor otherwise later than the most recent version, the service returns the\nresponse format for the latest version.\n\n### Credentials\n\nYou can download your credentials in a `json` file, or get them from the\ndeveloper console.\n\n[Details on IBM](https://www.ibm.com/watson/developercloud/doc/getting_started/gs-credentials.shtml)\n\n### Unit tests\n\nTest coverage is 100%, but you can also include a live API test to see\nif everything is working on that end. You shouldn't have to though,\n  but it can be useful.\n\nTo do live test export \n\n```bash\nexport DO_LIVE_API_TESTS=true\n```\n\nYou must also include your real `credentials.json` in\nthe root of the project (it is already in the `gitignore`).\n\nWhich will then do the live test.\n\n### Not yet supported\n\n* Delete from ContentItems collection\n* Modify within ContentItems collection\n* Full error and exception handling\n* Manipulation of the results\n* Minimum text length configuration\n* CSV\n\n## Contributing and Testing\n\nThere is currently 100% test coverage in the project, please ensure that\nwhen contributing you update the tests. For more info see CONTRIBUTING.md\n\n## Acknowledgements\n\n* [Dmitry Semenov](https://github.com/mxnr), as always.\n* Add yourself here!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdarrynten%2Fwatson-personality-insights-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdarrynten%2Fwatson-personality-insights-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdarrynten%2Fwatson-personality-insights-php/lists"}