PHP code example of dive-be / php-crowbar

1. Go to this page and download the library: Download dive-be/php-crowbar library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

dive-be / php-crowbar example snippets


class SealedCrate
{
    public function __construct(
        private string $content,
    ) {}
    
    private function peek(): string
    {
        return $this->content;
    }
}

$crate = new SealedCrate('Apples');

Crowbar::pry($crate)->content; // Apples

Crowbar::pry($crate)->content; // Original: Apples

Crowbar::pry($crate)->content = 'Strawberries';

Crowbar::pry($crate)->content; // Altered: Strawberries

Crowbar::pry($crate)->peek(); // Strawberries