CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Reporting Security Issues
    • Privacy Policy
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Get Involved
    • Issues (Github)
    • Bakery
    • Featured Resources
    • Training
    • Meetups
    • My CakePHP
    • CakeFest
    • Newsletter
    • Linkedin
    • YouTube
    • Facebook
    • Twitter
    • Mastodon
    • Help & Support
    • Forum
    • Stack Overflow
    • IRC
    • Slack
    • Paid Support
CakePHP

C CakePHP 5.4 Chiffon API

  • Project:
    • CakePHP
      • CakePHP
      • Authentication
      • Authorization
      • Chronos
      • Elastic Search
      • Queue
  • Version:
    • 5.4
      • 5.4
      • 5.3
      • 5.2
      • 5.1
      • 5.0
      • 4.6
      • 4.5
      • 4.4
      • 4.3
      • 4.2
      • 4.1
      • 4.0
      • 3.10
      • 3.9
      • 3.8
      • 3.7
      • 3.6
      • 3.5
      • 3.4
      • 3.3
      • 3.2
      • 3.1
      • 3.0
      • 2.10
      • 2.9
      • 2.8
      • 2.7
      • 2.6
      • 2.5
      • 2.4
      • 2.3
      • 2.2
      • 2.1
      • 2.0
      • 1.3
      • 1.2

Namespaces

  • Global
  • Cake
    • Cache
    • Collection
    • Command
    • Console
    • Container
    • Controller
    • Core
    • Database
    • Datasource
    • Error
    • Event
    • Form
    • Http
      • Client
      • Cookie
      • Exception
      • Link
      • Middleware
      • RateLimit
      • Response
      • Session
      • TestSuite
    • I18n
    • Lock
    • Log
    • Mailer
    • Network
    • ORM
    • Routing
    • TestSuite
    • Utility
    • Validation
    • View

Class LinkProvider

PSR-13 LinkProvider implementation.

Collects and provides hypermedia links.

Usage

$provider = new LinkProvider([
    new Link('/api/users', 'self'),
    new Link('/api/users?page=2', 'next'),
]);

foreach ($provider->getLinks() as $link) {
    echo $link->getHref();
}
Namespace: Cake\Http\Link

Method Summary

  • __construct() public

    Constructor.

  • getLinks() public

    Returns an iterable of LinkInterface objects.

  • getLinksByRel() public

    Returns an iterable of LinkInterface objects that have a specific relationship.

  • withLink() public

    Returns an instance with the specified link included.

  • withoutLink() public

    Returns an instance with the specifed link removed.

Method Detail

__construct() ¶ public

__construct(iterable<Psr\Link\LinkInterface> $links = [])

Constructor.

Parameters
iterable<Psr\Link\LinkInterface> $links optional

Initial links.

getLinks() ¶ public

getLinks(): iterable<LinkInterface>

Returns an iterable of LinkInterface objects.

The iterable may be an array or any PHP \Traversable object. If no links are available, an empty array or \Traversable MUST be returned.

Returns
iterable<LinkInterface>

getLinksByRel() ¶ public

getLinksByRel(string $rel): iterable<LinkInterface>

Returns an iterable of LinkInterface objects that have a specific relationship.

The iterable may be an array or any PHP \Traversable object. If no links with that relationship are available, an empty array or \Traversable MUST be returned.

Parameters
string $rel
Returns
iterable<LinkInterface>

withLink() ¶ public

withLink(LinkInterface $link): static

Returns an instance with the specified link included.

If the specified link is already present, this method MUST return normally without errors. The link is present if $link is === identical to a link object already in the collection.

Parameters
LinkInterface $link
Returns
static

withoutLink() ¶ public

withoutLink(LinkInterface $link): static

Returns an instance with the specifed link removed.

If the specified link is not present, this method MUST return normally without errors. The link is present if $link is === identical to a link object already in the collection.

Parameters
LinkInterface $link
Returns
static
OpenHub
Pingping
Linode
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Reporting Security Issues
  • Privacy Policy
  • Logos & Trademarks
  • Community
  • Get Involved
  • Issues (Github)
  • Bakery
  • Featured Resources
  • Training
  • Meetups
  • My CakePHP
  • CakeFest
  • Newsletter
  • Linkedin
  • YouTube
  • Facebook
  • Twitter
  • Mastodon
  • Help & Support
  • Forum
  • Stack Overflow
  • IRC
  • Slack
  • Paid Support

Generated using CakePHP API Docs