Telosys doc
WebsiteTwitterLinkedInNews
  • Telosys documentation
  • Telosys CLI
    • Installation on Linux
    • Installation on Windows
    • CLI configuration
    • CLI commands
    • Getting started
  • Telosys with VSCode
    • Extension installation
    • VSCode settings
    • Telosys terminal in VSCode
    • Telosys editor configuration
  • Telosys with JetBrains IDE
  • Project configuration
  • Project variables
  • Project databases
  • Models and entities
    • Model structure
    • Entity
    • Attribute / Link
    • Annotations
    • Tags
    • Examples
    • Model creation
    • Model installation
    • Models management
  • Bundles of templates
    • Bundle structure
    • Bundle creation
    • Bundles installation
    • Bundles management
    • Velocity language
    • Velocity directives
    • Velocity object types
    • Telosys directives
    • Telosys variables
    • Telosys objects
    • Code snippets
  • Code generation
    • "gen" command
    • "genb" command
  • Target languages
    • C++
    • C#
    • Golang
    • Java
    • JavaScript
    • Kotlin
    • PHP
    • Python
    • Scala
    • TypeScript
  • Target databases (SQL)
    • Predefined rules
    • Specific rules
    • Type size and precision
  • Telosys with Git
    • GitHub usage
    • Install with Git
    • Publish with Git
  • Support the project
  • How to contribute
  • Sponsors
  • IDE and editors
  • Telosys 3 Eclipse plugin
    • Eclipse plugin installation
    • Eclipse customization
    • Telosys 3 database model
Powered by GitBook
On this page
  • Types conversion
  • Literal values
  • TRUE, FALSE, NULL
  1. Target languages

PHP

PreviousKotlinNextPython

Last updated 1 year ago

To define PHP as the target language in a template file :

#set( $env.language = 'PHP' )

A "?" is automatically added at the beginning of the type if the attribute is "nullable" (no "@NotNull" annotation). To disable this behavior:

#set( $env.typeWithNullableMark = false )

The information below shows the behavior of the generator when PHP is the current target language. For a detailed description of type conversion, see the generated documentation :

Types conversion

Typed class properties were added in PHP 7.4 ( )

So since Telosys version 4.1.0, type conversion was added for the PHP language.

Model type
PHP property type
with annotation

string

?string

string

@NotNull

byte

?int int

@NotNull

short

?int int

@NotNull

int

?int int

@NotNull

long

?int int

@NotNull

decimal

?float float

@NotNull

float

?float float

@NotNull

double

?float float

@NotNull

boolean

?bool bool

@NotNull

date

?DateTime DateTime

@NotNull

time

?DateTime DateTime

@NotNull

timestamp

?DateTime DateTime

@NotNull

binary

Literal values

TRUE, FALSE, NULL

PHP literal

TRUE

true

FALSE

false

NULL

null

https://www.telosys.org/doc/latest/languages/language-php.html
https://php.watch/versions/7.4/typed-properties