{"id":20312499,"url":"https://github.com/hstanleycrow/easyphptowordpress","last_synced_at":"2026-04-16T07:30:48.596Z","repository":{"id":159035058,"uuid":"614588666","full_name":"hstanleycrow/EasyPHPToWordpress","owner":"hstanleycrow","description":"publish in Wordpress from PHP using WP API","archived":false,"fork":false,"pushed_at":"2023-05-02T23:51:59.000Z","size":136,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-14T12:25:11.005Z","etag":null,"topics":["php","php8","wordpress","wordpress-api"],"latest_commit_sha":null,"homepage":"","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/hstanleycrow.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-15T22:40:30.000Z","updated_at":"2024-08-04T12:01:26.000Z","dependencies_parsed_at":"2023-07-11T07:33:48.581Z","dependency_job_id":null,"html_url":"https://github.com/hstanleycrow/EasyPHPToWordpress","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hstanleycrow%2FEasyPHPToWordpress","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hstanleycrow%2FEasyPHPToWordpress/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hstanleycrow%2FEasyPHPToWordpress/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hstanleycrow%2FEasyPHPToWordpress/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hstanleycrow","download_url":"https://codeload.github.com/hstanleycrow/EasyPHPToWordpress/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241811589,"owners_count":20024221,"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":["php","php8","wordpress","wordpress-api"],"created_at":"2024-11-14T18:06:27.834Z","updated_at":"2026-04-16T07:30:48.569Z","avatar_url":"https://github.com/hstanleycrow.png","language":"PHP","funding_links":["https://www.buymeacoffee.com/haroldcrow"],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n  \u003cbr\u003e\n  Easy PHP To Wordpress\n  \u003cbr\u003e\n\u003c/h1\u003e\n\n\u003ch4 align=\"center\"\u003eFree PHP Library to post from PHP to Wordpress\u003c/h4\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"#key-features\"\u003eKey Features\u003c/a\u003e •\n  \u003ca href=\"#how-to-use\"\u003eHow To Use\u003c/a\u003e •\n  \u003ca href=\"#download\"\u003eDownload\u003c/a\u003e •\n  \u003ca href=\"#credits\"\u003eCredits\u003c/a\u003e •\n  \u003ca href=\"#license\"\u003eLicense\u003c/a\u003e\n\u003c/p\u003e\n\n## Key Features\n\n* Get Categories - Get a list of categories from Worpress site\n* Get Tags - Get a list of tags from Worpress site\n* Publish HTML content, including:\n  - Featured Image\n  - Category\n  - Status: publish, draft, pending, etc\n  - all images are uploaded to wordpress and the image URL is replaced by the Wordpress URL\n  - You can include Youtube videos in the content\n  - You can include Tweets in the content\n* Wordpress URL Validator\n* Wordpress credentials (user and application password) validator\n* Easily handle errors\n\n## How To Use\n\n```bash\n# Clone this repository\n$ git clone https://github.com/hstanleycrow/EasyPHPToWordpress/\n\n# install libraries\n$ composer update\n\n# or install using composer\n\n$ composer require hstanleycrow/easyphptowordpress\n```\n\n```php\n# define credentials\n# You need a Wordpress application password https://make.wordpress.org/core/2020/11/05/application-passwords-integration-guide/\n#This examples are using [DotEnv](https://github.com/vlucas/phpdotenv) to configure the credentials, but you can setup it as you want.\n$wpSiteURL = $_ENV[\"WP_SITE_URL\"];\n$wpUsername = $_ENV[\"WP_USERNAME\"];\n$wpApplicationPassword = $_ENV[\"WP_APPLICATION_PASSWORD\"];\n\n# configure in your PHP script the timezone to the Wordpress timezone. This is important.\ndate_default_timezone_set(\"America/El_Salvador\");\n\n# create an object \n$obj = new WordpressAPI($wpSiteURL, $wpUsername, $wpApplicationPassword);\n```\n\n### Examples\n```php\n#Example to validate the URL\n\nif ($obj-\u003evalidateURL()) :\n    echo \"URL resolve 200\";\nelse :\n    echo $obj-\u003eerrorMessage();\nendif;\n\n#Example how to get Wordpress Categories list\n\necho \"\u003cpre\u003e\";\nif ($categories = $obj-\u003ecategories()) :\n    print_r($categories);\nelse :\n    echo $obj-\u003eerrorMessage();\nendif;\necho \"\u003c/pre\u003e\";\n\n#Example how to get Wordpress Tags list\n\necho \"\u003cpre\u003e\";\nif ($tags = $obj-\u003etags()) :\n    print_r($tags);\nelse :\n    echo $obj-\u003eerrorMessage();\nendif;\necho \"\u003c/pre\u003e\";\n\n#Example how to validate credentials\n\necho \"\u003cpre\u003e\";\nif ($obj-\u003evalidateCredentials()) :\n    echo \"Valid Credentials\" . PHP_EOL;\nelse :\n    echo \"Credentials not valid\" . PHP_EOL;\n    echo $obj-\u003eerrorMessage() . PHP_EOL;\nendif;\necho \"\u003c/pre\u003e\";\n\n#Example to publish into WP\n$content = \u003c\u003c\u003cHTML\n\u003cp\u003e\u003cb\u003e Hey\u003c/b\u003e this is some text for the blog post\u003c/p\u003e\n\u003ch2\u003e\u003ca id=\"user-content-documentation\" class=\"anchor\" href=\"#user-content-documentation\" rel=\"nofollow noindex noopener external ugc\"\u003e\u003c/a\u003eDocumentation\u003c/h2\u003e\n\u003cp\u003eThe documentation for this library is hosted at \u003ca href=\"https://simplehtmldom.sourceforge.io/docs/\" rel=\"nofollow noindex noopener external ugc\"\u003ehttps://simplehtmldom.sourceforge.io/docs/\u003c/a\u003e\u003c/p\u003e\n\u003cp\u003e\u003cimg src=\"https://eluniverso.space/wp-content/uploads/1143px-The_Sagittarius_dwarf_galaxy_in_Gaias_all-sky_view_ESA399651.jpg\" alt=\"Sagitarius dwarf galaxy\" title=\"Sagitarius\" \u003e\n\u003ch2\u003eYoutube Video\u003c/h2\u003e\n\u003cp\u003ehttps://www.youtube.com/watch?v=K4TOrB7at0Y\u003c/p\u003e\n\u003ch2\u003eTweet Thread\u003c/h2\u003e\n\u003cp\u003ehttps://twitter.com/elonmusk/status/1645266104351178752?s=20\u003c/p\u003e\n\u003cp\u003e\u003cimg src=\"//eluniverso.space/wp-content/uploads/Positional-Schematic-of-the-Members-of-the-HR-8799-Exoplanet-System-777x777-1.jpg\" alt=\"HR 8799 planet orbits\" title=\"HR 8799 planet orbits\"\u003e\n\u003cbr\u003e\u003cbr\u003e\n\u003cp\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAApgAAAKYB3X3/OAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAANCSURBVEiJtZZPbBtFFMZ/M7ubXdtdb1xSFyeilBapySVU8h8OoFaooFSqiihIVIpQBKci6KEg9Q6H9kovIHoCIVQJJCKE1ENFjnAgcaSGC6rEnxBwA04Tx43t2FnvDAfjkNibxgHxnWb2e/u992bee7tCa00YFsffekFY+nUzFtjW0LrvjRXrCDIAaPLlW0nHL0SsZtVoaF98mLrx3pdhOqLtYPHChahZcYYO7KvPFxvRl5XPp1sN3adWiD1ZAqD6XYK1b/dvE5IWryTt2udLFedwc1+9kLp+vbbpoDh+6TklxBeAi9TL0taeWpdmZzQDry0AcO+jQ12RyohqqoYoo8RDwJrU+qXkjWtfi8Xxt58BdQuwQs9qC/afLwCw8tnQbqYAPsgxE1S6F3EAIXux2oQFKm0ihMsOF71dHYx+f3NND68ghCu1YIoePPQN1pGRABkJ6Bus96CutRZMydTl+TvuiRW1m3n0eDl0vRPcEysqdXn+jsQPsrHMquGeXEaY4Yk4wxWcY5V/9scqOMOVUFthatyTy8QyqwZ+kDURKoMWxNKr2EeqVKcTNOajqKoBgOE28U4tdQl5p5bwCw7BWquaZSzAPlwjlithJtp3pTImSqQRrb2Z8PHGigD4RZuNX6JYj6wj7O4TFLbCO/Mn/m8R+h6rYSUb3ekokRY6f/YukArN979jcW+V/S8g0eT/N3VN3kTqWbQ428m9/8k0P/1aIhF36PccEl6EhOcAUCrXKZXXWS3XKd2vc/TRBG9O5ELC17MmWubD2nKhUKZa26Ba2+D3P+4/MNCFwg59oWVeYhkzgN/JDR8deKBoD7Y+ljEjGZ0sosXVTvbc6RHirr2reNy1OXd6pJsQ+gqjk8VWFYmHrwBzW/n+uMPFiRwHB2I7ih8ciHFxIkd/3Omk5tCDV1t+2nNu5sxxpDFNx+huNhVT3/zMDz8usXC3ddaHBj1GHj/As08fwTS7Kt1HBTmyN29vdwAw+/wbwLVOJ3uAD1wi/dUH7Qei66PfyuRj4Ik9is+hglfbkbfR3cnZm7chlUWLdwmprtCohX4HUtlOcQjLYCu+fzGJH2QRKvP3UNz8bWk1qMxjGTOMThZ3kvgLI5AzFfo379UAAAAASUVORK5CYII=\"\u003e\u003c/p\u003e\n\u003cp\u003e\u003cimg src=\"https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/DroidSans-Bold.svg\" alt=\"SVG Image\"\u003e\nHTML;\n$featureImagePath = \"https://eluniverso.space/wp-content/uploads/Three-merging-galaxies-1-1024x511.jpg\";\n$categories = [58];\necho \"\u003cpre\u003e\";\nif ($url = $obj-\u003epublishPost(\n    \"Title of the post\",\n    $content,\n    $categories,\n    $featureImagePath\n)) :\n    echo $url . PHP_EOL;\n    if ($obj-\u003ehasImagesErrors()) :\n        print_r($obj-\u003eimagesError());\n    endif;\nelse :\n    #echo \"Credentials not valid\" . PHP_EOL;\n    echo $obj-\u003eerrorMessage() . PHP_EOL;\nendif;\necho \"\u003c/pre\u003e\";\n\n```\n\n## Limitations\n* For now, you can't add tags to the post but it is considered for future versions.\n\n## Download\n\nYou can [download](https://github.com/hstanleycrow/EasyPHPToWordpress/) the latest version here.\n\n## PHP Versions\nI have tested this class only in this PHP versions. So, if you have an older version and do not work, let me know.\n| PHP Version |\n| ------------- |\n| PHP 8.0 | \n| PHP 8.1 |\n| PHP 8.2 |\n\n## Credits\n\nThis software uses the following open source packages:\n\n- [PHP Simple HTML DOM Parser](https://simplehtmldom.sourceforge.io/docs/1.9/index.html)\n\n## Support\n\n\u003ca href=\"https://www.buymeacoffee.com/haroldcrow\" target=\"_blank\"\u003e\u003cimg src=\"https://www.buymeacoffee.com/assets/img/custom_images/purple_img.png\" alt=\"Buy Me A Coffee\" style=\"height: 41px !important;width: 174px !important;box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;\" \u003e\u003c/a\u003e\n\n## License\n\nMIT\n\n---\n\n\u003e [www.hablemosdeseo.net](https://www.hablemosdeseo.net) \u0026nbsp;\u0026middot;\u0026nbsp;\n\u003e GitHub [@hstanleycrow](https://github.com/hstanleycrow) \u0026nbsp;\u0026middot;\u0026nbsp;\n\u003e Twitter [@harold_crow](https://twitter.com/harold_crow)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhstanleycrow%2Feasyphptowordpress","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhstanleycrow%2Feasyphptowordpress","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhstanleycrow%2Feasyphptowordpress/lists"}