{"id":20036987,"url":"https://github.com/antistatique/drupal-entity-to-text","last_synced_at":"2026-02-25T09:27:56.022Z","repository":{"id":41272808,"uuid":"508713567","full_name":"antistatique/drupal-entity-to-text","owner":"antistatique","description":"Provides a number of utility and helper APIs for developers to transform content into plain text.","archived":false,"fork":false,"pushed_at":"2025-11-07T14:08:47.000Z","size":103,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"1.3.x","last_synced_at":"2025-11-07T16:10:45.816Z","etag":null,"topics":["drupal","drupal-9","drupal-module"],"latest_commit_sha":null,"homepage":"https://www.drupal.org/project/entity_to_text","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/antistatique.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":null,"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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-06-29T13:56:32.000Z","updated_at":"2025-11-07T14:08:45.000Z","dependencies_parsed_at":"2024-04-13T10:49:19.441Z","dependency_job_id":null,"html_url":"https://github.com/antistatique/drupal-entity-to-text","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/antistatique/drupal-entity-to-text","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antistatique%2Fdrupal-entity-to-text","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antistatique%2Fdrupal-entity-to-text/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antistatique%2Fdrupal-entity-to-text/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antistatique%2Fdrupal-entity-to-text/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/antistatique","download_url":"https://codeload.github.com/antistatique/drupal-entity-to-text/tar.gz/refs/heads/1.3.x","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antistatique%2Fdrupal-entity-to-text/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29815943,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-25T05:36:42.804Z","status":"ssl_error","status_checked_at":"2026-02-25T05:36:31.934Z","response_time":61,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["drupal","drupal-9","drupal-module"],"created_at":"2024-11-13T10:17:44.710Z","updated_at":"2026-02-25T09:27:56.004Z","avatar_url":"https://github.com/antistatique.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Entity to Text\n\nThis suite is primarily a set of APIs and tools to improve the developer experience.\n\nThis module provides a number of utility and helper APIs for developers to transform content into plain text.\n\n## Use Entity to Text if\n\n  - You need to get plain-text content of Nodes for Indexing content into a Search Engine (Solr, Elasticsearch, ...).\n  - You want to get plain-text of Nodes Paragraphs for SEO or JSON-LD.\n  - You need to transform \"Node entity\" field(s) into plain-text content.\n  - You need to transform \"Paragraphs entity\" field(s) into plain-text content.\n  - You need to transform \"File entity\" into plain-text through Tika.\n\n## Dependencies\n\nThe main module requires `ezyang/htmlpurifier`\n\nThe submodule `entity_to_text_tika` requires the library `vaites/php-apache-tika`.\nThe submodule `entity_to_text_paragraphs` requires the library `drupal/paragraphs`.\n\n### Which version should I use?\n\n| Drupal Core | Entity to Text |\n|:-----------:|:--------------:|\n|     8.x     |       -        |\n|     9.x     |     1.0.x      |\n|    10.x     |     1.1.x      |\n|    11.x     |     1.1.x      |\n\n## Getting Started\n\nWe highly recommend you to install the module using `composer`.\n\n```bash\n$ composer require drupal/entity_to_text\n```\n\n## Examples\n\n### Node fields to text\n\n#### Usage\n\n```php\n/** @var string $field_body_content */\n$field_body_content = \\Drupal::service('entity_to_text.extractor.node_to_text')-\u003efromFieldtoText('body', $node);\n/** @var string $field_foo_content */\n$field_foo_content = \\Drupal::service('entity_to_text.extractor.node_to_text')-\u003efromFieldtoText('field_foo', $node);\n```\n\n### Paragraphs to text\n\n#### Prerequisite\n\n- Enabled `entity_to_text_paragraphs` module\n\n#### Usage\n\n```php\n/** @var array[] $bodies */\n$bodies = \\Drupal::service('entity_to_text_paragraphs.extractor.paragraphs_to_text')-\u003efromParagraphToText($node-\u003efield_paragraphs);\n```\n\n### File to text\n\n#### Prerequisite\n\n- Having access to Tika as a RESTful API via the Tika server.\n- Enabled `entity_to_text_tika` module\n- Setup the `settings.php` configuration\n\n```php\n/**\n * Apache Tika connection.\n */\n$settings['entity_to_text_tika.connection']['host'] = 'tika';\n$settings['entity_to_text_tika.connection']['port'] = '9998';\n```\n\n#### Usage\n\n```php\n/** @var \\Drupal\\file\\Entity\\File $file */\n$file = $file_item-\u003eentity;\n$body = \\Drupal::service('entity_to_text_tika.extractor.file_to_text')-\u003efromFileToText($file, 'eng+fra');\n```\n\nor for an advanced usage avoiding multiple calls to Tika by using cached ocr file:\n\n```php\n// Anywhere at least once in the code (Eg. module.install) in order to prepare the storage.\n\\Drupal::service('entity_to_text_tika.storage.local_file')-\u003eprepareStorage();\n\n// Load the already OCR'ed file if possible to avoid unecessary calls to Tika.\n$body = \\Drupal::service('entity_to_text_tika.storage.local_file')-\u003eload($file, 'eng+fra');\n\nif (!$body) {\n  // When the OCR'ed file is not available, then run Tika over it and store it for the next run.\n  $body = \\Drupal::service('entity_to_text_tika.extractor.file_to_text')-\u003efromFileToText($file, 'eng+fra');\n  // Save the OCR'ed file for the next run.\n  \\Drupal::service('entity_to_text_tika.storage.local_file')-\u003esave($file, $body, 'eng+fra');\n}\n```\n\n### Generate OCR via CLI\n\nThe module provides a Drush command for generating OCR (Optical Character Recognition) for all files within Drupal.\n_It's important to note that this command should be used judiciously due to its potential resource intensity._\n\nIts primary objective is to generate OCR for files that have not undergone OCR processing yet.\nIt's designed to work seamlessly with the Advanced feature set, leveraging cached OCR files efficiently.\nThis command proves especially useful after a fresh installation, the addition of a new OCR language,\nor during file migrations.\n\n```bash\n# Warmup all files that does not already have an associated .ocr file.\ndrush e2t:t:w\n# Warmup all files even if the files has already been processed before.\ndrush e2t:t:w --force\n# Warmup the file with FID 2.\ndrush e2t:t:w --fid=2\n```\n\n## Supporting organizations\n\nThis project is sponsored by [Antistatique](https://www.antistatique.net), a Swiss Web Agency.\nVisit us at [www.antistatique.net](https://www.antistatique.net) or\n[Contact us](mailto:info@antistatique.net).\n\n## Credits\n\nEntity to Text is currently maintained by [Kevin Wenger](https://github.com/wengerk). Thank you to all our wonderful [contributors](https://github.com/antistatique/drupal-entity-to-text/contributors) too.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantistatique%2Fdrupal-entity-to-text","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fantistatique%2Fdrupal-entity-to-text","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantistatique%2Fdrupal-entity-to-text/lists"}