-1

Sorry for the confusing title, however,

I'm interested in creating a function that creates new default model, view, and controller files with the name i supply through the function to a defined URL directory.

To be more clear, i want to auto create a model view and controller through one function and place them in my directory without having to individually create and label them.

The process seems quite clear, though my concern is finding the best way to call this function only when i need it and assuring that random users cant access it and create a bunch of files on my server. Would this be something i create in a form on a restricted page?

To be more clear in my question:

What would be the best and most secure way to call this function?

tereško
  • 58,060
  • 25
  • 98
  • 150
Pacifici
  • 3
  • 4
  • You shouldn't be generating code for production-destined code. Also .. how the hell do you intend to generate "model", since it is a layer. – tereško Dec 07 '14 at 21:06
  • Good look with that .. come back when you have understood the basics of MVC. – tereško Dec 08 '14 at 01:14
  • I understand the basics. I dont want to create new folders and files for each component whenever i wish to make a new page. Thanks anyway. – Pacifici Dec 08 '14 at 01:23
  • What you are looking for is called "scaffolding". It is a method for generating throw-away code. This really cannot (or - shouldn't) be applied to MVC architectural pattern, because "model" is **not a class** and "views" in MVC are actually complex instances, which contain all of the UI logic. Also, MVC pattern is not meant for hello-world level code, but instead are used to contain the complexity for large codebases. Creating files at such scales take up less then 0.1% of development time. – tereško Dec 08 '14 at 11:40
  • Hmm I see what you are saying and understand your point. Thanks! – Pacifici Dec 08 '14 at 20:04

1 Answers1

-1

More secure is to use CLI - Command Line Interface, For example Laravel's Artisan CLI:

php artisan:makemigration create_table

Creates Migration files in app/database/migrations folder, or:

php artisan controller:make PhotoController

Creates controller in app/controllers folder So it's not secure if this function will be in WEB PAGE, because anyone can access it and manipulate your project, more secure in CLI, when you connect your server by SSH connection and type some commands. Hope I help.