{"action":"created","issue":{"url":"https://api.github.com/repos/jedisct1/libsodium-php/issues/29","labels_url":"https://api.github.com/repos/jedisct1/libsodium-php/issues/29/labels{/name}","comments_url":"https://api.github.com/repos/jedisct1/libsodium-php/issues/29/comments","events_url":"https://api.github.com/repos/jedisct1/libsodium-php/issues/29/events","html_url":"https://github.com/jedisct1/libsodium-php/pull/29","id":85921602,"number":29,"title":"\"Sodium\" namespace/container class removed","user":{"login":"wlejon","id":921636,"avatar_url":"https://avatars.githubusercontent.com/u/921636?v=3","gravatar_id":"","url":"https://api.github.com/users/wlejon","html_url":"https://github.com/wlejon","followers_url":"https://api.github.com/users/wlejon/followers","following_url":"https://api.github.com/users/wlejon/following{/other_user}","gists_url":"https://api.github.com/users/wlejon/gists{/gist_id}","starred_url":"https://api.github.com/users/wlejon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wlejon/subscriptions","organizations_url":"https://api.github.com/users/wlejon/orgs","repos_url":"https://api.github.com/users/wlejon/repos","events_url":"https://api.github.com/users/wlejon/events{/privacy}","received_events_url":"https://api.github.com/users/wlejon/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-06-07T17:34:35Z","updated_at":"2015-06-07T20:07:33Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/jedisct1/libsodium-php/pulls/29","html_url":"https://github.com/jedisct1/libsodium-php/pull/29","diff_url":"https://github.com/jedisct1/libsodium-php/pull/29.diff","patch_url":"https://github.com/jedisct1/libsodium-php/pull/29.patch"},"body":"I'm not sure the reception on something like this. Seemed awkward to have a class specifically to behave as a namespace (only static functions). In switching to namespaces, that was also awkward.\r\n\r\nWhat I've found to be more consistent with traditional PHP extensions is to more closely mirror the underlying API. \r\n\r\nAt the very least, I'd like to open a discussion on changing the API to be more consistent with other PHP low level APIs. "},"comment":{"url":"https://api.github.com/repos/jedisct1/libsodium-php/issues/comments/109794772","html_url":"https://github.com/jedisct1/libsodium-php/pull/29#issuecomment-109794772","issue_url":"https://api.github.com/repos/jedisct1/libsodium-php/issues/29","id":109794772,"user":{"login":"wlejon","id":921636,"avatar_url":"https://avatars.githubusercontent.com/u/921636?v=3","gravatar_id":"","url":"https://api.github.com/users/wlejon","html_url":"https://github.com/wlejon","followers_url":"https://api.github.com/users/wlejon/followers","following_url":"https://api.github.com/users/wlejon/following{/other_user}","gists_url":"https://api.github.com/users/wlejon/gists{/gist_id}","starred_url":"https://api.github.com/users/wlejon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wlejon/subscriptions","organizations_url":"https://api.github.com/users/wlejon/orgs","repos_url":"https://api.github.com/users/wlejon/repos","events_url":"https://api.github.com/users/wlejon/events{/privacy}","received_events_url":"https://api.github.com/users/wlejon/received_events","type":"User","site_admin":false},"created_at":"2015-06-07T20:07:32Z","updated_at":"2015-06-07T20:07:32Z","body":"Ha. Can't please everyone, I suppose.\r\n\r\nPractical usage of the API as it stands is quite awkward. If the PECL requirement stemmed on polluting the global namespace, adding a namespace may be better than creating a class.\r\n\r\nUsage would be:\r\n```php\r\nusing namespace Sodium;\r\n$nonce = randombytes_buf(CRYPTO_SECRETBOX_NONCEBYTES);\r\n$ciphertext = crypto_secretbox('test', $nonce, $key);\r\n$plaintext = crypto_secretbox_open($ciphertext, $nonce, $key);\r\n```\r\n\r\nAlternatively, without bringing in the namespace:\r\n```php\r\n$nonce = \\Sodium\\randombyes_buf(\\Sodium\\CRYPTO_SECRETBOX_NONCEBYTES);\r\n```\r\nThoughts?\r\n\r\n"}}