A method of generating an amplitude-modulated optical output signal, said method being carried out by a photonic transistor, the photonic transistor comprising a guiding element and a nonlinear element integrated together on a substrate, wherein the guiding element has a first pathway including a phase-modulation element, a second pathway, an interference area and an output pathway, the guiding element being formed of a photonic bandgap element composed of periodic structures arranged in an array on the substrate, the periodic structures having a spacing related to a wavelength of a first optical input signal and a second optical input signal, wherein the first and second pathways (18, 20), the interference area and the output pathway are defined by the absence of structures, and wherein the nonlinear element comprises one or more of a laser, a cavity or a non-resonant amplifier; the method comprising the steps of: a) receiving said first optical input signal, the first optical input signal generated in a light source and focused, modulating a phase of the first optical input signal by means of said phase-modulation element and guiding the phase-modulated first optical input signal in the first pathway of the guiding element to the interference area defined in the guiding element; b) filtering the phase-modulated first optical input signal; (c) receiving said second optical input signal, the second optical input signal generated in a light source and focused and guiding the second optical input signal in the second pathway of the guiding element to the interference area defined in the guiding element, the light sources being arranged to allow constructive or destructive interference of the first and second optical input signals; (d) filtering the second optical input signal e) combining the filtered first and second optical input signals in the interference area of the guiding element to generate an optical interference signal having amplitude modulation dependent upon the phase modulation of at least the first optical input signal; f) nonlinearly discriminating the optical interference signal with the nonlinear element to determine logic states of the optical interference signal to form an amplitude-modulated optical output signal having a digital logic state, wherein the digital logic state is one of a "0" and a "1" digital logic states, and g) guiding the optical output signal in the output pathway defined in the guiding element, focusing the optical output signal on an output element and outputting the optical output signal. a) receiving said first optical input signal, the first optical input signal generated in a light source and focused, modulating a phase of the first optical input signal by means of said phase-modulation element and guiding the phase-modulated first optical input signal in the first pathway of the guiding element to the interference area defined in the guiding element; b) filtering the phase-modulated first optical input signal; (c) receiving said second optical input signal, the second optical input signal generated in a light source and focused and guiding the second optical input signal in the second pathway of the guiding element to the interference area defined in the guiding element, the light sources being arranged to allow constructive or destructive interference of the first and second optical input signals; (d) filtering the second optical input signal e) combining the filtered first and second optical input signals in the interference area of the guiding element to generate an optical interference signal having amplitude modulation dependent upon the phase modulation of at least the first optical input signal; f) nonlinearly discriminating the optical interference signal with the nonlinear element to determine logic states of the optical interference signal to form an amplitude-modulated optical output signal having a digital logic state, wherein the digital logic state is one of a "0" and a "1" digital logic states, and g) guiding the optical output signal in the output pathway defined in the guiding element, focusing the optical output signal on an output element and outputting the optical output signal.