class User { private $username; public function setUserName($name) { $this->username = $name; } } $user = new User(); $user->setUserName('JohnDoe');In this example, we have a User class that has a private property `$username`, and a public method `setUserName` that sets the value of `$username`. We then create a new User object and call the `setUserName` method with the value 'JohnDoe'. The package or library used for this example is not specified, as this is a basic PHP feature and does not require any external dependencies.