Comfortable | Docs
  • Comfortable Documentation
  • Concepts
    • Content Repositories
    • Content Types
    • Documents
    • Assets
    • Content Tree
    • Collections
    • Webhooks
    • Team
    • Locales
  • APIs
    • RESTful API
      • Endpoints
      • API Reference
        • Sorting
        • Filters
        • Localisation
        • Fields
        • Includes
        • Search
      • Query Examples
        • Collections
        • Single Documents
        • Single Assets
        • Sorting
        • Filters
        • Includes
    • Image Manipulation
  • SDKs
    • JavaScript
      • Query Options
      • Query All Documents
      • Query a Collection
      • Query a Single Document
      • Query an Alias
      • Query an Asset
      • Example: Filters
      • Example: Sorting
    • Nuxt.js
    • PHP
      • Query All Documents
      • Query Single Document
      • Query Collection
      • Query an Alias
      • Query an Asset
      • Fulltext Search
      • Query by Fields
      • Query by Type
      • Query by Id
      • Query by Tags
  • Guides
    • Vue Blog Example
  • Legal
    • Legal Notice
    • Privacy Policy
Powered by GitBook
On this page
  • Query by IncludeTags
  • Query by ExcludeTags
  • Combine IncludeTags & ExcludeTags
  1. SDKs
  2. PHP

Query by Tags

Here we will show you how you can perform queries based on tags

Query by IncludeTags

<?php
// $results will be include all documents with the tag "include" or "me"
$results = $api->getDocuments()
  ->includeTags(["include", "me"])
  ->execute();

Query by ExcludeTags

<?php
// $results will exclude all documents with the "exclude me" tag
$results = $api->getDocuments()
  ->excludeTags(["exclude"])
  ->execute();

Combine IncludeTags & ExcludeTags

<?php
// $results will hold all documents with the tag "sports",
// except the documents with the "soccer" tag.
$results = $api->getDocuments()
  ->includeTags(["sports"])
  ->excludeTags(["soccer"])
  ->execute();
PreviousQuery by IdNextVue Blog Example

Last updated 6 years ago