{"id":5488,"date":"2026-06-15T10:00:00","date_gmt":"2026-06-15T10:00:00","guid":{"rendered":"https:\/\/frontlinenewsng.org\/?p=5488"},"modified":"2026-06-15T10:00:00","modified_gmt":"2026-06-15T10:00:00","slug":"akismet-introducing-the-official-akismet-php-sdk","status":"publish","type":"post","link":"https:\/\/frontlinenewsng.org\/?p=5488","title":{"rendered":"Akismet: Introducing the official Akismet PHP SDK"},"content":{"rendered":"<figure class=\"wp-block-image size-large\"><img data-opt-id=1062607537  fetchpriority=\"high\" data-recalc-dims=\"1\" decoding=\"async\" alt=\"\" class=\"wp-image-284805\" height=\"268\" src=\"https:\/\/mlcqvjhyzqda.i.optimole.com\/cb:UNMm.7bb\/w:auto\/h:auto\/q:mauto\/f:best\/https:\/\/i0.wp.com\/akismet.com\/wp-content\/uploads\/2026\/06\/screenshot-2026-06-10-at-11.38.37-am.png?resize=640%2C268&#038;ssl=1\" width=\"640\" \/><\/figure>\n<div class=\"wp-block-jetpack-markdown\">\n<p>For twenty years, Akismet has kept spam out of WordPress. But spammers don\u2019t care what your site runs on and neither do we.<\/p>\n<p>Last month we launched the <a href=\"https:\/\/akismet.com\/blog\/introducing-the-official-akismet-drupal-module\/\">official Akismet Drupal module<\/a>. Today we\u2019re introducing the engine that powers it: the official Akismet PHP SDK, a first-party client that brings Akismet to any PHP application.<\/p>\n<h2>What it is, and who it\u2019s for<\/h2>\n<p>The Akismet PHP SDK is a first-party PHP client for the Akismet API. It\u2019s built for the platforms the WordPress plugin doesn\u2019t reach: custom apps, SaaS backends, and PHP frameworks like Laravel and Symfony. (The official plugins are still the way to go for <a href=\"https:\/\/wordpress.org\/plugins\/akismet\/\">WordPress<\/a> and <a href=\"https:\/\/www.drupal.org\/project\/akismet_antispam\">Drupal<\/a>.)<\/p>\n<p>Under the hood it\u2019s built to feel at home in a modern PHP codebase:<\/p>\n<ul>\n<li>Covers the full Akismet API, from comment-check and spam\/ham submissions to key verification, usage limits, and account stats.<\/li>\n<li>Works with any PSR-18 HTTP client you already have (Guzzle, Symfony HttpClient, and the like) through auto-discovery.<\/li>\n<li>Ships a typed exception hierarchy that redacts your API key, so credentials never leak into your logs.<\/li>\n<\/ul>\n<h2>A two-minute quick start<\/h2>\n<p>Install it with Composer:<\/p>\n<pre><code class=\"language-bash\">composer require automattic\/akismet-sdk\n<\/code><\/pre>\n<p>Then check a submission:<\/p>\n<pre><code class=\"language-php\">use AutomatticAkismetAkismet;\nuse AutomatticAkismetDTOContent;\nuse AutomatticAkismetEnumContentType;\n\n$akismet = Akismet::create(\n    apiKey: 'your-api-key',\n    site: 'https:\/\/your-site.com',\n);\n\n$content = new Content(\n    userIp: $_SERVER['REMOTE_ADDR'],\n    userAgent: $_SERVER['HTTP_USER_AGENT'],\n    body: $formData['message'],\n    authorEmail: $formData['email'],\n    type: ContentType::ContactForm,\n);\n\n$result = $akismet-&amp;gt;check($content);\n\nif ($result-&amp;gt;isSpam()) {\n    \/\/ Reject it, flag it, or queue it for review.\n    \/\/ $result-&amp;gt;shouldDiscard() marks the blatant spam you can drop outright.\n}\n<\/code><\/pre>\n<p>That\u2019s the loop: build a <code>Content<\/code> object, call <code>check()<\/code>, act on the result.<\/p>\n<h2>Already running in production<\/h2>\n<p>The official Akismet <a href=\"https:\/\/www.drupal.org\/project\/akismet_antispam\">Drupal module<\/a> is built on this SDK. The SDK handles the API contract and type safety, while the module handles Drupal\u2019s service wiring, queues, and moderation UI. That\u2019s the pattern for Laravel, Symfony, and anything else you build: the SDK owns the Akismet integration and your framework owns the glue.<\/p>\n<h2>What\u2019s new in 1.5.0<\/h2>\n<p>We have just released v1.5.0, which is about giving Akismet more to work with, and giving you more back:<\/p>\n<ul>\n<li><strong>Richer content signals:<\/strong> <code>Content<\/code> now carries the site\u2019s language and character set, plus the surrounding conversation context, so every check has more to go on.<\/li>\n<li><strong>More insight into every verdict:<\/strong> <code>CheckResult<\/code> now surfaces the error and classification Akismet returns, so you can log and act on <em>why<\/em> something was flagged, not just whether it was.<\/li>\n<li><strong>Extended multi-site reporting:<\/strong> For keys that span many sites, the new extended key-sites data adds per-site metadata for cleaner reporting and account hygiene.<\/li>\n<\/ul>\n<h2>Get started<\/h2>\n<p>The SDK is open source and live on Packagist today.<\/p>\n<ul>\n<li>Install: <code>composer require automattic\/akismet-sdk<\/code><\/li>\n<li>Packagist: <a href=\"https:\/\/packagist.org\/packages\/automattic\/akismet-sdk\">automattic\/akismet-sdk<\/a><\/li>\n<li>Source and docs: <a href=\"https:\/\/github.com\/Automattic\/akismet-sdk-php\">github.com\/Automattic\/akismet-sdk-php<\/a><\/li>\n<\/ul>\n<p>You\u2019ll need an Akismet API key to make calls. Akismet\u2019s <a href=\"https:\/\/akismet.com\/pricing\/\">Personal plan<\/a> is pay-what-you-can and free for personal, non-commercial sites. If you\u2019re running something commercial, pick a paid plan that matches your traffic. Either way your code stays identical, since the plan lives with your API key, not in the SDK.<\/p>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>For twenty years, Akismet has kept spam out of WordPress. But spammers don\u2019t care what your site runs on and neither do we. Last month we launched the official Akismet Drupal module. Today we\u2019re introducing the engine that powers it: the official Akismet PHP SDK, a first-party client that brings Akismet to any PHP application. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":5489,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[1],"tags":[],"class_list":["post-5488","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-latest-news"],"jetpack_featured_media_url":"https:\/\/mlcqvjhyzqda.i.optimole.com\/cb:0DOi.83c\/w:auto\/h:auto\/q:mauto\/f:best\/https:\/\/i0.wp.com\/frontlinenewsng.org\/wp-content\/uploads\/2026\/06\/screenshot-2026-06-10-at-11.38.37-am-BxqJaW.png?fit=1022%2C429&ssl=1","jetpack_likes_enabled":true,"jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/frontlinenewsng.org\/index.php?rest_route=\/wp\/v2\/posts\/5488","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/frontlinenewsng.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/frontlinenewsng.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/frontlinenewsng.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/frontlinenewsng.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5488"}],"version-history":[{"count":0,"href":"https:\/\/frontlinenewsng.org\/index.php?rest_route=\/wp\/v2\/posts\/5488\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/frontlinenewsng.org\/index.php?rest_route=\/wp\/v2\/media\/5489"}],"wp:attachment":[{"href":"https:\/\/frontlinenewsng.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5488"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/frontlinenewsng.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5488"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/frontlinenewsng.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5488"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}