diff --git a/php/.gitignore b/php/.gitignore index 170af1cf6..90dfe37d3 100644 --- a/php/.gitignore +++ b/php/.gitignore @@ -2,5 +2,6 @@ Chat/Chat.php Chat/PollingChat.php Glacier2/hello/Hello.php Ice/hello/Hello.php +Ice/greeter/Greeter.php Ice/optional/Contact.php IceDiscovery/hello/Hello.php diff --git a/php/Ice/greeter/Client.php b/php/Ice/greeter/Client.php new file mode 100644 index 000000000..46a86f217 --- /dev/null +++ b/php/Ice/greeter/Client.php @@ -0,0 +1,21 @@ +greet(get_current_user()); + +echo "$greeting\n"; +?> diff --git a/php/Ice/greeter/Greeter.ice b/php/Ice/greeter/Greeter.ice new file mode 100644 index 000000000..0835f945f --- /dev/null +++ b/php/Ice/greeter/Greeter.ice @@ -0,0 +1,15 @@ +// Copyright (c) ZeroC, Inc. + +#pragma once + +module VisitorCenter +{ + /// Represents a simple greeter. + interface Greeter + { + /// Creates a personalized greeting. + /// @param name The name of the person to greet. + /// @return The greeting. + string greet(string name); + } +} diff --git a/php/Ice/greeter/README.md b/php/Ice/greeter/README.md new file mode 100644 index 000000000..3eb7e2664 --- /dev/null +++ b/php/Ice/greeter/README.md @@ -0,0 +1,20 @@ +# Greeter + +The Greeter demo illustrates how to write a client application with Ice for PHP. + +Ice for PHP supports only client-side applications. As a result, you first need to start a Greeter server implemented +in a language with server-side support, such as Python, Java, or C#. + +Then, in a separate window: + +- Compile Greeter.ice with the Slice to PHP compiler into Greeter.php + +```shell +slice2php Greeter.ice +``` + +- Run the client application + +```shell +php Client.php +``` diff --git a/ruby/Ice/greeter/README.md b/ruby/Ice/greeter/README.md index c53c8eb75..806b94327 100644 --- a/ruby/Ice/greeter/README.md +++ b/ruby/Ice/greeter/README.md @@ -7,13 +7,13 @@ in a language with server-side support, such as Python, Java, or C#. Then, in a separate window: -- compile Greeter.ice with the Slice to Ruby compiler into Greeter.rb +- Compile Greeter.ice with the Slice to Ruby compiler into Greeter.rb ```shell slice2rb Greeter.ice ``` -- run the client application +- Run the client application ```shell ruby client.rb