Several methods encourage code automatic generation, and CASE (Computer-Aided Software Engineering) tools are conventionally used for this task. However, these tools do not fully automate the process of code generation, and developers are still needed to complete the resulting source code. In addition, the generated source code does not reflect a layer-based architecture, like MVC (Model View Controller), which is highly desirable to separate the business rules from the application functionality. Lastly, many CASE tools use, as a starting point, diagrams that are not easy to interpret by stakeholders. In such a situation, the source code can not reflect the problem domain features. In order to partially solve these problems, in this paper we propose a set of heuristic rules for automatically generating PHP source code, under the MVC programming pattern from pre-conceptual schemas. This proposal is exemplified by means of a case study.